Skip to content

Commit ddcfe64

Browse files
committed
feat: adding endpoints for script get endpoints
1 parent 59ac975 commit ddcfe64

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

service/privatelink/service.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@ func (a *API) GetActiveActivePrivateLink(ctx context.Context, subscription int,
124124
return task, nil
125125
}
126126

127+
// GetPrivateLinkEndpointScript will get the script for an endpoint.
128+
func (a *API) GetActiveActivePrivateLinkEndpointScript(ctx context.Context, subscription int, regionId int) (*PrivateLinkEndpointScript, error) {
129+
message := fmt.Sprintf("get private link for subscription %d", subscription)
130+
path := fmt.Sprintf("/subscriptions/%d/regions/%d/private-link/endpoint-script/?includeTerraformAwsScript=true", subscription)
131+
task, err := a.getScript(ctx, message, path)
132+
if err != nil {
133+
return nil, wrap404Error(subscription, err)
134+
}
135+
return task, nil
136+
}
137+
127138
// CreateActiveActivePrincipal will add a principal to an active active PrivateLink.
128139
func (a *API) CreateActiveActivePrincipal(ctx context.Context, subscriptionId int, regionId int, principal CreatePrivateLinkPrincipal) error {
129140
message := fmt.Sprintf("create principal %s for subscription %d", *principal.Principal, subscriptionId)
@@ -176,7 +187,7 @@ func (a *API) get(ctx context.Context, message string, path string) (*PrivateLin
176187
return nil, err
177188
}
178189

179-
a.logger.Printf("Waiting for privatelink request %d to complete", task.ID)
190+
a.logger.Printf("Waiting for PrivateLink get request %d to complete", task.ID)
180191

181192
var response PrivateLink
182193
err = a.taskWaiter.WaitForResource(ctx, *task.ID, &response)
@@ -194,7 +205,7 @@ func (a *API) getScript(ctx context.Context, message string, path string) (*Priv
194205
return nil, err
195206
}
196207

197-
a.logger.Printf("Waiting for privatelink request %d to complete", task.ID)
208+
a.logger.Printf("Waiting for PrivateLink script get request %d to complete", task.ID)
198209

199210
var response PrivateLinkEndpointScript
200211
err = a.taskWaiter.WaitForResource(ctx, *task.ID, &response)
@@ -212,7 +223,7 @@ func (a *API) delete(ctx context.Context, message string, path string, requestBo
212223
return err
213224
}
214225

215-
a.logger.Printf("Waiting for task %s to finish deleting", task)
226+
a.logger.Printf("Waiting for task %s to finish deleting the PrivateLink", task)
216227

217228
err = a.taskWaiter.Wait(ctx, *task.ID)
218229
if err != nil {

0 commit comments

Comments
 (0)