-
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 #885 from hashicorp/auto-pr/3b3c7b35
Auto PR: Regenerating the Go SDK (186194b)
- Loading branch information
Showing
45 changed files
with
1,845 additions
and
2,210 deletions.
There are no files selected for viewing
22 changes: 15 additions & 7 deletions
22
resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/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 availabilitygrouplisteners | ||
|
||
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 AvailabilityGroupListenersClient struct { | ||
Client autorest.Client | ||
baseUri string | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewAvailabilityGroupListenersClientWithBaseURI(endpoint string) AvailabilityGroupListenersClient { | ||
return AvailabilityGroupListenersClient{ | ||
Client: autorest.NewClientWithUserAgent(userAgent()), | ||
baseUri: endpoint, | ||
func NewAvailabilityGroupListenersClientWithBaseURI(sdkApi sdkEnv.Api) (*AvailabilityGroupListenersClient, error) { | ||
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "availabilitygrouplisteners", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating AvailabilityGroupListenersClient: %+v", err) | ||
} | ||
|
||
return &AvailabilityGroupListenersClient{ | ||
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
...-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/method_createorupdate.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 availabilitygrouplisteners | ||
|
||
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 CreateOrUpdateOperationResponse struct { | ||
Poller pollers.Poller | ||
HttpResponse *http.Response | ||
OData *odata.OData | ||
Model *AvailabilityGroupListener | ||
} | ||
|
||
// CreateOrUpdate ... | ||
func (c AvailabilityGroupListenersClient) CreateOrUpdate(ctx context.Context, id AvailabilityGroupListenerId, input AvailabilityGroupListener) (result CreateOrUpdateOperationResponse, 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 | ||
} | ||
|
||
// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed | ||
func (c AvailabilityGroupListenersClient) CreateOrUpdateThenPoll(ctx context.Context, id AvailabilityGroupListenerId, input AvailabilityGroupListener) error { | ||
result, err := c.CreateOrUpdate(ctx, id, input) | ||
if err != nil { | ||
return fmt.Errorf("performing CreateOrUpdate: %+v", err) | ||
} | ||
|
||
if err := result.Poller.PollUntilDone(ctx); err != nil { | ||
return fmt.Errorf("polling after CreateOrUpdate: %+v", err) | ||
} | ||
|
||
return nil | ||
} |
80 changes: 0 additions & 80 deletions
80
...sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/method_createorupdate_autorest.go
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/method_delete.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,71 @@ | ||
package availabilitygrouplisteners | ||
|
||
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 DeleteOperationResponse struct { | ||
Poller pollers.Poller | ||
HttpResponse *http.Response | ||
OData *odata.OData | ||
} | ||
|
||
// Delete ... | ||
func (c AvailabilityGroupListenersClient) Delete(ctx context.Context, id AvailabilityGroupListenerId) (result DeleteOperationResponse, err error) { | ||
opts := client.RequestOptions{ | ||
ContentType: "application/json; charset=utf-8", | ||
ExpectedStatusCodes: []int{ | ||
http.StatusAccepted, | ||
http.StatusNoContent, | ||
http.StatusOK, | ||
}, | ||
HttpMethod: http.MethodDelete, | ||
Path: id.ID(), | ||
} | ||
|
||
req, err := c.Client.NewRequest(ctx, opts) | ||
if 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 | ||
} | ||
|
||
// DeleteThenPoll performs Delete then polls until it's completed | ||
func (c AvailabilityGroupListenersClient) DeleteThenPoll(ctx context.Context, id AvailabilityGroupListenerId) error { | ||
result, err := c.Delete(ctx, id) | ||
if err != nil { | ||
return fmt.Errorf("performing Delete: %+v", err) | ||
} | ||
|
||
if err := result.Poller.PollUntilDone(ctx); err != nil { | ||
return fmt.Errorf("polling after Delete: %+v", err) | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.