-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #940 from hashicorp/auto-pr/4c47d693
Auto PR: Regenerating the Go SDK (ec0083f)
- Loading branch information
Showing
37 changed files
with
1,370 additions
and
1,740 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 15 additions & 7 deletions
22
resource-manager/containerinstance/2023-05-01/containerinstance/client.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
package containerinstance | ||
|
||
import "github.com/Azure/go-autorest/autorest" | ||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" | ||
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type ContainerInstanceClient struct { | ||
Client autorest.Client | ||
baseUri string | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewContainerInstanceClientWithBaseURI(endpoint string) ContainerInstanceClient { | ||
return ContainerInstanceClient{ | ||
Client: autorest.NewClientWithUserAgent(userAgent()), | ||
baseUri: endpoint, | ||
func NewContainerInstanceClientWithBaseURI(sdkApi sdkEnv.Api) (*ContainerInstanceClient, error) { | ||
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "containerinstance", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating ContainerInstanceClient: %+v", err) | ||
} | ||
|
||
return &ContainerInstanceClient{ | ||
Client: client, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...er/containerinstance/2023-05-01/containerinstance/method_containergroupscreateorupdate.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package containerinstance | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"net/http" | ||
|
||
"github.com/hashicorp/go-azure-sdk/sdk/client" | ||
"github.com/hashicorp/go-azure-sdk/sdk/client/pollers" | ||
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" | ||
"github.com/hashicorp/go-azure-sdk/sdk/odata" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type ContainerGroupsCreateOrUpdateOperationResponse struct { | ||
Poller pollers.Poller | ||
HttpResponse *http.Response | ||
OData *odata.OData | ||
Model *ContainerGroup | ||
} | ||
|
||
// ContainerGroupsCreateOrUpdate ... | ||
func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdate(ctx context.Context, id ContainerGroupId, input ContainerGroup) (result ContainerGroupsCreateOrUpdateOperationResponse, err error) { | ||
opts := client.RequestOptions{ | ||
ContentType: "application/json; charset=utf-8", | ||
ExpectedStatusCodes: []int{ | ||
http.StatusCreated, | ||
http.StatusOK, | ||
}, | ||
HttpMethod: http.MethodPut, | ||
Path: id.ID(), | ||
} | ||
|
||
req, err := c.Client.NewRequest(ctx, opts) | ||
if err != nil { | ||
return | ||
} | ||
|
||
if err = req.Marshal(input); err != nil { | ||
return | ||
} | ||
|
||
var resp *client.Response | ||
resp, err = req.Execute(ctx) | ||
if resp != nil { | ||
result.OData = resp.OData | ||
result.HttpResponse = resp.Response | ||
} | ||
if err != nil { | ||
return | ||
} | ||
|
||
result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) | ||
if err != nil { | ||
return | ||
} | ||
|
||
return | ||
} | ||
|
||
// ContainerGroupsCreateOrUpdateThenPoll performs ContainerGroupsCreateOrUpdate then polls until it's completed | ||
func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdateThenPoll(ctx context.Context, id ContainerGroupId, input ContainerGroup) error { | ||
result, err := c.ContainerGroupsCreateOrUpdate(ctx, id, input) | ||
if err != nil { | ||
return fmt.Errorf("performing ContainerGroupsCreateOrUpdate: %+v", err) | ||
} | ||
|
||
if err := result.Poller.PollUntilDone(ctx); err != nil { | ||
return fmt.Errorf("polling after ContainerGroupsCreateOrUpdate: %+v", err) | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.