diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md b/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md index 18301a06d4fb..08354b64fe2c 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.3.1 (2023-08-09) +### Other Changes + + ## 0.3.0 (2023-05-26) ### Breaking Changes diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client.go index 0c10e0a8abad..61def02a8900 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking @@ -60,9 +59,10 @@ func (client *AssociationsInterfaceClient) BeginCreateOrUpdate(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssociationsInterfaceClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssociationsInterfaceClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[AssociationsInterfaceClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,18 +73,20 @@ func (client *AssociationsInterfaceClient) BeginCreateOrUpdate(ctx context.Conte // // Generated from API version 2023-05-01-preview func (client *AssociationsInterfaceClient) createOrUpdate(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, resource Association, options *AssociationsInterfaceClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, trafficControllerName, associationName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -114,7 +116,10 @@ func (client *AssociationsInterfaceClient) createOrUpdateCreateRequest(ctx conte reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Association @@ -132,9 +137,10 @@ func (client *AssociationsInterfaceClient) BeginDelete(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssociationsInterfaceClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssociationsInterfaceClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[AssociationsInterfaceClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,18 +151,20 @@ func (client *AssociationsInterfaceClient) BeginDelete(ctx context.Context, reso // // Generated from API version 2023-05-01-preview func (client *AssociationsInterfaceClient) deleteOperation(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, options *AssociationsInterfaceClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, trafficControllerName, associationName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -199,18 +207,21 @@ func (client *AssociationsInterfaceClient) deleteCreateRequest(ctx context.Conte // - options - AssociationsInterfaceClientGetOptions contains the optional parameters for the AssociationsInterfaceClient.Get // method. func (client *AssociationsInterfaceClient) Get(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, options *AssociationsInterfaceClientGetOptions) (AssociationsInterfaceClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, trafficControllerName, associationName, options) if err != nil { return AssociationsInterfaceClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AssociationsInterfaceClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AssociationsInterfaceClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AssociationsInterfaceClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -333,18 +344,21 @@ func (client *AssociationsInterfaceClient) listByTrafficControllerHandleResponse // - options - AssociationsInterfaceClientUpdateOptions contains the optional parameters for the AssociationsInterfaceClient.Update // method. func (client *AssociationsInterfaceClient) Update(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, properties AssociationUpdate, options *AssociationsInterfaceClientUpdateOptions) (AssociationsInterfaceClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, trafficControllerName, associationName, properties, options) if err != nil { return AssociationsInterfaceClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AssociationsInterfaceClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AssociationsInterfaceClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AssociationsInterfaceClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -374,7 +388,10 @@ func (client *AssociationsInterfaceClient) updateCreateRequest(ctx context.Conte reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client_example_test.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client_example_test.go deleted file mode 100644 index 6163dda66fad..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client_example_test.go +++ /dev/null @@ -1,198 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armservicenetworking_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/armservicenetworking" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationsGet.json -func ExampleAssociationsInterfaceClient_NewListByTrafficControllerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssociationsInterfaceClient().NewListByTrafficControllerPager("rg1", "tc1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssociationListResult = armservicenetworking.AssociationListResult{ - // Value: []*armservicenetworking.Association{ - // { - // Name: to.Ptr("as1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/associations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.AssociationProperties{ - // AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // Subnet: &armservicenetworking.AssociationSubnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationGet.json -func ExampleAssociationsInterfaceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssociationsInterfaceClient().Get(ctx, "rg1", "tc1", "as1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Association = armservicenetworking.Association{ - // Name: to.Ptr("as1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/associations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.AssociationProperties{ - // AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // Subnet: &armservicenetworking.AssociationSubnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationPut.json -func ExampleAssociationsInterfaceClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssociationsInterfaceClient().BeginCreateOrUpdate(ctx, "rg1", "tc1", "as1", armservicenetworking.Association{ - Location: to.Ptr("NorthCentralUS"), - Properties: &armservicenetworking.AssociationProperties{ - AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - Subnet: &armservicenetworking.AssociationSubnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Association = armservicenetworking.Association{ - // Name: to.Ptr("associatedvnet-1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/associations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.AssociationProperties{ - // AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // Subnet: &armservicenetworking.AssociationSubnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationPatch.json -func ExampleAssociationsInterfaceClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssociationsInterfaceClient().Update(ctx, "rg1", "tc1", "as1", armservicenetworking.AssociationUpdate{ - Properties: &armservicenetworking.AssociationUpdateProperties{ - AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - Subnet: &armservicenetworking.AssociationSubnetUpdate{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Association = armservicenetworking.Association{ - // Name: to.Ptr("as1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/associations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.AssociationProperties{ - // AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - // Subnet: &armservicenetworking.AssociationSubnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationDelete.json -func ExampleAssociationsInterfaceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssociationsInterfaceClient().BeginDelete(ctx, "rg1", "tc1", "as1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/autorest.md b/sdk/resourcemanager/servicenetworking/armservicenetworking/autorest.md index fe63520d94c8..6f1f4194964d 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/autorest.md +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/servicenetworking/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/servicenetworking/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.3.0 -tag: package-2023-05-01-preview +module-version: 0.3.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/client_factory.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/client_factory.go index f6a45e9c3ff3..a2f1f6b2b4d4 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/client_factory.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking @@ -38,22 +37,22 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewAssociationsInterfaceClient() *AssociationsInterfaceClient { + subClient, _ := NewAssociationsInterfaceClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTrafficControllerInterfaceClient() *TrafficControllerInterfaceClient { - subClient, _ := NewTrafficControllerInterfaceClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewFrontendsInterfaceClient() *FrontendsInterfaceClient { + subClient, _ := NewFrontendsInterfaceClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewAssociationsInterfaceClient() *AssociationsInterfaceClient { - subClient, _ := NewAssociationsInterfaceClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewFrontendsInterfaceClient() *FrontendsInterfaceClient { - subClient, _ := NewFrontendsInterfaceClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewTrafficControllerInterfaceClient() *TrafficControllerInterfaceClient { + subClient, _ := NewTrafficControllerInterfaceClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go index 28c1198f4a5f..23965b784190 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking const ( moduleName = "armservicenetworking" - moduleVersion = "v0.3.0" + moduleVersion = "v0.3.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client.go index fed375cb6aeb..7b62a6d130ef 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking @@ -60,9 +59,10 @@ func (client *FrontendsInterfaceClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FrontendsInterfaceClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FrontendsInterfaceClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[FrontendsInterfaceClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,18 +73,20 @@ func (client *FrontendsInterfaceClient) BeginCreateOrUpdate(ctx context.Context, // // Generated from API version 2023-05-01-preview func (client *FrontendsInterfaceClient) createOrUpdate(ctx context.Context, resourceGroupName string, trafficControllerName string, frontendName string, resource Frontend, options *FrontendsInterfaceClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, trafficControllerName, frontendName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -114,7 +116,10 @@ func (client *FrontendsInterfaceClient) createOrUpdateCreateRequest(ctx context. reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Frontend @@ -132,9 +137,10 @@ func (client *FrontendsInterfaceClient) BeginDelete(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FrontendsInterfaceClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FrontendsInterfaceClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[FrontendsInterfaceClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,18 +151,20 @@ func (client *FrontendsInterfaceClient) BeginDelete(ctx context.Context, resourc // // Generated from API version 2023-05-01-preview func (client *FrontendsInterfaceClient) deleteOperation(ctx context.Context, resourceGroupName string, trafficControllerName string, frontendName string, options *FrontendsInterfaceClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, trafficControllerName, frontendName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -198,18 +206,21 @@ func (client *FrontendsInterfaceClient) deleteCreateRequest(ctx context.Context, // - frontendName - Frontends // - options - FrontendsInterfaceClientGetOptions contains the optional parameters for the FrontendsInterfaceClient.Get method. func (client *FrontendsInterfaceClient) Get(ctx context.Context, resourceGroupName string, trafficControllerName string, frontendName string, options *FrontendsInterfaceClientGetOptions) (FrontendsInterfaceClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, trafficControllerName, frontendName, options) if err != nil { return FrontendsInterfaceClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FrontendsInterfaceClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FrontendsInterfaceClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FrontendsInterfaceClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -332,18 +343,21 @@ func (client *FrontendsInterfaceClient) listByTrafficControllerHandleResponse(re // - options - FrontendsInterfaceClientUpdateOptions contains the optional parameters for the FrontendsInterfaceClient.Update // method. func (client *FrontendsInterfaceClient) Update(ctx context.Context, resourceGroupName string, trafficControllerName string, frontendName string, properties FrontendUpdate, options *FrontendsInterfaceClientUpdateOptions) (FrontendsInterfaceClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, trafficControllerName, frontendName, properties, options) if err != nil { return FrontendsInterfaceClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FrontendsInterfaceClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FrontendsInterfaceClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FrontendsInterfaceClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -373,7 +387,10 @@ func (client *FrontendsInterfaceClient) updateCreateRequest(ctx context.Context, reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client_example_test.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client_example_test.go deleted file mode 100644 index 8f7a9d6de743..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client_example_test.go +++ /dev/null @@ -1,175 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armservicenetworking_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/armservicenetworking" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendsGet.json -func ExampleFrontendsInterfaceClient_NewListByTrafficControllerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFrontendsInterfaceClient().NewListByTrafficControllerPager("rg1", "tc1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FrontendListResult = armservicenetworking.FrontendListResult{ - // Value: []*armservicenetworking.Frontend{ - // { - // Name: to.Ptr("fe1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/frontends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.FrontendProperties{ - // Fqdn: to.Ptr("test.net"), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendGet.json -func ExampleFrontendsInterfaceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFrontendsInterfaceClient().Get(ctx, "rg1", "tc1", "fe1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Frontend = armservicenetworking.Frontend{ - // Name: to.Ptr("fe1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/frontends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.FrontendProperties{ - // Fqdn: to.Ptr("test.net"), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendPut.json -func ExampleFrontendsInterfaceClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFrontendsInterfaceClient().BeginCreateOrUpdate(ctx, "rg1", "tc1", "fe1", armservicenetworking.Frontend{ - Location: to.Ptr("NorthCentralUS"), - Properties: &armservicenetworking.FrontendProperties{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Frontend = armservicenetworking.Frontend{ - // Name: to.Ptr("fe1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/frontends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.FrontendProperties{ - // Fqdn: to.Ptr("test.net"), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendPatch.json -func ExampleFrontendsInterfaceClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFrontendsInterfaceClient().Update(ctx, "rg1", "tc1", "fe1", armservicenetworking.FrontendUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Frontend = armservicenetworking.Frontend{ - // Name: to.Ptr("fe1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/frontends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.FrontendProperties{ - // Fqdn: to.Ptr("test.net"), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendDelete.json -func ExampleFrontendsInterfaceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFrontendsInterfaceClient().BeginDelete(ctx, "rg1", "tc1", "fe1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/go.mod b/sdk/resourcemanager/servicenetworking/armservicenetworking/go.mod index 7e086ffa5b1b..9de024d9e17d 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/go.mod +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/a go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/go.sum b/sdk/resourcemanager/servicenetworking/armservicenetworking/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/go.sum +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go index e4920bea519e..2111d1db8771 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking @@ -86,36 +85,6 @@ type AssociationUpdateProperties struct { Subnet *AssociationSubnetUpdate } -// AssociationsInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the AssociationsInterfaceClient.BeginCreateOrUpdate -// method. -type AssociationsInterfaceClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AssociationsInterfaceClientBeginDeleteOptions contains the optional parameters for the AssociationsInterfaceClient.BeginDelete -// method. -type AssociationsInterfaceClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AssociationsInterfaceClientGetOptions contains the optional parameters for the AssociationsInterfaceClient.Get method. -type AssociationsInterfaceClientGetOptions struct { - // placeholder for future optional parameters -} - -// AssociationsInterfaceClientListByTrafficControllerOptions contains the optional parameters for the AssociationsInterfaceClient.NewListByTrafficControllerPager -// method. -type AssociationsInterfaceClientListByTrafficControllerOptions struct { - // placeholder for future optional parameters -} - -// AssociationsInterfaceClientUpdateOptions contains the optional parameters for the AssociationsInterfaceClient.Update method. -type AssociationsInterfaceClientUpdateOptions struct { - // placeholder for future optional parameters -} - // Frontend Subresource of Traffic Controller. type Frontend struct { // REQUIRED; The geo-location where the resource lives @@ -164,36 +133,6 @@ type FrontendUpdate struct { Tags map[string]*string } -// FrontendsInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the FrontendsInterfaceClient.BeginCreateOrUpdate -// method. -type FrontendsInterfaceClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FrontendsInterfaceClientBeginDeleteOptions contains the optional parameters for the FrontendsInterfaceClient.BeginDelete -// method. -type FrontendsInterfaceClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FrontendsInterfaceClientGetOptions contains the optional parameters for the FrontendsInterfaceClient.Get method. -type FrontendsInterfaceClientGetOptions struct { - // placeholder for future optional parameters -} - -// FrontendsInterfaceClientListByTrafficControllerOptions contains the optional parameters for the FrontendsInterfaceClient.NewListByTrafficControllerPager -// method. -type FrontendsInterfaceClientListByTrafficControllerOptions struct { - // placeholder for future optional parameters -} - -// FrontendsInterfaceClientUpdateOptions contains the optional parameters for the FrontendsInterfaceClient.Update method. -type FrontendsInterfaceClientUpdateOptions struct { - // placeholder for future optional parameters -} - // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -243,11 +182,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // ResourceID - Resource ID definition used by parent to reference child resources. type ResourceID struct { // REQUIRED; Resource ID of child resource. @@ -299,44 +233,6 @@ type TrafficController struct { Type *string } -// TrafficControllerInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the TrafficControllerInterfaceClient.BeginCreateOrUpdate -// method. -type TrafficControllerInterfaceClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TrafficControllerInterfaceClientBeginDeleteOptions contains the optional parameters for the TrafficControllerInterfaceClient.BeginDelete -// method. -type TrafficControllerInterfaceClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TrafficControllerInterfaceClientGetOptions contains the optional parameters for the TrafficControllerInterfaceClient.Get -// method. -type TrafficControllerInterfaceClientGetOptions struct { - // placeholder for future optional parameters -} - -// TrafficControllerInterfaceClientListByResourceGroupOptions contains the optional parameters for the TrafficControllerInterfaceClient.NewListByResourceGroupPager -// method. -type TrafficControllerInterfaceClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// TrafficControllerInterfaceClientListBySubscriptionOptions contains the optional parameters for the TrafficControllerInterfaceClient.NewListBySubscriptionPager -// method. -type TrafficControllerInterfaceClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// TrafficControllerInterfaceClientUpdateOptions contains the optional parameters for the TrafficControllerInterfaceClient.Update -// method. -type TrafficControllerInterfaceClientUpdateOptions struct { - // placeholder for future optional parameters -} - // TrafficControllerListResult - The response of a TrafficController list operation. type TrafficControllerListResult struct { // REQUIRED; The TrafficController items on this page diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/models_serde.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/models_serde.go index 72c9f4b191da..536539de5918 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/models_serde.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client.go index 2910109ac53a..494280ccef07 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client_example_test.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client_example_test.go deleted file mode 100644 index 10ff1d0d6d10..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client_example_test.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armservicenetworking_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/armservicenetworking" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/OperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armservicenetworking.OperationListResult{ - // Value: []*armservicenetworking.Operation{ - // { - // Name: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/read"), - // Display: &armservicenetworking.OperationDisplay{ - // Description: to.Ptr("Traffic Controller is a L7 Load Balancing solution for a Multi Cluster setup"), - // Operation: to.Ptr("Get Traffic Controller configuration"), - // Provider: to.Ptr("Microsoft Service Networking"), - // Resource: to.Ptr("Traffic Controller"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armservicenetworking.OriginUserSystem), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/options.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/options.go new file mode 100644 index 000000000000..35b047221323 --- /dev/null +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/options.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armservicenetworking + +// AssociationsInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the AssociationsInterfaceClient.BeginCreateOrUpdate +// method. +type AssociationsInterfaceClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AssociationsInterfaceClientBeginDeleteOptions contains the optional parameters for the AssociationsInterfaceClient.BeginDelete +// method. +type AssociationsInterfaceClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AssociationsInterfaceClientGetOptions contains the optional parameters for the AssociationsInterfaceClient.Get method. +type AssociationsInterfaceClientGetOptions struct { + // placeholder for future optional parameters +} + +// AssociationsInterfaceClientListByTrafficControllerOptions contains the optional parameters for the AssociationsInterfaceClient.NewListByTrafficControllerPager +// method. +type AssociationsInterfaceClientListByTrafficControllerOptions struct { + // placeholder for future optional parameters +} + +// AssociationsInterfaceClientUpdateOptions contains the optional parameters for the AssociationsInterfaceClient.Update method. +type AssociationsInterfaceClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// FrontendsInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the FrontendsInterfaceClient.BeginCreateOrUpdate +// method. +type FrontendsInterfaceClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FrontendsInterfaceClientBeginDeleteOptions contains the optional parameters for the FrontendsInterfaceClient.BeginDelete +// method. +type FrontendsInterfaceClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FrontendsInterfaceClientGetOptions contains the optional parameters for the FrontendsInterfaceClient.Get method. +type FrontendsInterfaceClientGetOptions struct { + // placeholder for future optional parameters +} + +// FrontendsInterfaceClientListByTrafficControllerOptions contains the optional parameters for the FrontendsInterfaceClient.NewListByTrafficControllerPager +// method. +type FrontendsInterfaceClientListByTrafficControllerOptions struct { + // placeholder for future optional parameters +} + +// FrontendsInterfaceClientUpdateOptions contains the optional parameters for the FrontendsInterfaceClient.Update method. +type FrontendsInterfaceClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// TrafficControllerInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the TrafficControllerInterfaceClient.BeginCreateOrUpdate +// method. +type TrafficControllerInterfaceClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TrafficControllerInterfaceClientBeginDeleteOptions contains the optional parameters for the TrafficControllerInterfaceClient.BeginDelete +// method. +type TrafficControllerInterfaceClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TrafficControllerInterfaceClientGetOptions contains the optional parameters for the TrafficControllerInterfaceClient.Get +// method. +type TrafficControllerInterfaceClientGetOptions struct { + // placeholder for future optional parameters +} + +// TrafficControllerInterfaceClientListByResourceGroupOptions contains the optional parameters for the TrafficControllerInterfaceClient.NewListByResourceGroupPager +// method. +type TrafficControllerInterfaceClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// TrafficControllerInterfaceClientListBySubscriptionOptions contains the optional parameters for the TrafficControllerInterfaceClient.NewListBySubscriptionPager +// method. +type TrafficControllerInterfaceClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// TrafficControllerInterfaceClientUpdateOptions contains the optional parameters for the TrafficControllerInterfaceClient.Update +// method. +type TrafficControllerInterfaceClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/response_types.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/response_types.go index 3e6bf4aa4c33..3cd51f53b009 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/response_types.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/response_types.go @@ -3,14 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking // AssociationsInterfaceClientCreateOrUpdateResponse contains the response from method AssociationsInterfaceClient.BeginCreateOrUpdate. type AssociationsInterfaceClientCreateOrUpdateResponse struct { + // Association Subresource of Traffic Controller Association } @@ -21,21 +21,25 @@ type AssociationsInterfaceClientDeleteResponse struct { // AssociationsInterfaceClientGetResponse contains the response from method AssociationsInterfaceClient.Get. type AssociationsInterfaceClientGetResponse struct { + // Association Subresource of Traffic Controller Association } // AssociationsInterfaceClientListByTrafficControllerResponse contains the response from method AssociationsInterfaceClient.NewListByTrafficControllerPager. type AssociationsInterfaceClientListByTrafficControllerResponse struct { + // The response of a Association list operation. AssociationListResult } // AssociationsInterfaceClientUpdateResponse contains the response from method AssociationsInterfaceClient.Update. type AssociationsInterfaceClientUpdateResponse struct { + // Association Subresource of Traffic Controller Association } // FrontendsInterfaceClientCreateOrUpdateResponse contains the response from method FrontendsInterfaceClient.BeginCreateOrUpdate. type FrontendsInterfaceClientCreateOrUpdateResponse struct { + // Frontend Subresource of Traffic Controller. Frontend } @@ -46,26 +50,31 @@ type FrontendsInterfaceClientDeleteResponse struct { // FrontendsInterfaceClientGetResponse contains the response from method FrontendsInterfaceClient.Get. type FrontendsInterfaceClientGetResponse struct { + // Frontend Subresource of Traffic Controller. Frontend } // FrontendsInterfaceClientListByTrafficControllerResponse contains the response from method FrontendsInterfaceClient.NewListByTrafficControllerPager. type FrontendsInterfaceClientListByTrafficControllerResponse struct { + // The response of a Frontend list operation. FrontendListResult } // FrontendsInterfaceClientUpdateResponse contains the response from method FrontendsInterfaceClient.Update. type FrontendsInterfaceClientUpdateResponse struct { + // Frontend Subresource of Traffic Controller. Frontend } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // TrafficControllerInterfaceClientCreateOrUpdateResponse contains the response from method TrafficControllerInterfaceClient.BeginCreateOrUpdate. type TrafficControllerInterfaceClientCreateOrUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. TrafficController } @@ -76,20 +85,24 @@ type TrafficControllerInterfaceClientDeleteResponse struct { // TrafficControllerInterfaceClientGetResponse contains the response from method TrafficControllerInterfaceClient.Get. type TrafficControllerInterfaceClientGetResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. TrafficController } // TrafficControllerInterfaceClientListByResourceGroupResponse contains the response from method TrafficControllerInterfaceClient.NewListByResourceGroupPager. type TrafficControllerInterfaceClientListByResourceGroupResponse struct { + // The response of a TrafficController list operation. TrafficControllerListResult } // TrafficControllerInterfaceClientListBySubscriptionResponse contains the response from method TrafficControllerInterfaceClient.NewListBySubscriptionPager. type TrafficControllerInterfaceClientListBySubscriptionResponse struct { + // The response of a TrafficController list operation. TrafficControllerListResult } // TrafficControllerInterfaceClientUpdateResponse contains the response from method TrafficControllerInterfaceClient.Update. type TrafficControllerInterfaceClientUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. TrafficController } diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/time_rfc3339.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/time_rfc3339.go index 446f0e25de9b..ede556346d54 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/time_rfc3339.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client.go index 711816d52361..e3c9f7eadc19 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armservicenetworking @@ -59,9 +58,10 @@ func (client *TrafficControllerInterfaceClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TrafficControllerInterfaceClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TrafficControllerInterfaceClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[TrafficControllerInterfaceClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,18 +72,20 @@ func (client *TrafficControllerInterfaceClient) BeginCreateOrUpdate(ctx context. // // Generated from API version 2023-05-01-preview func (client *TrafficControllerInterfaceClient) createOrUpdate(ctx context.Context, resourceGroupName string, trafficControllerName string, resource TrafficController, options *TrafficControllerInterfaceClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, trafficControllerName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -109,7 +111,10 @@ func (client *TrafficControllerInterfaceClient) createOrUpdateCreateRequest(ctx reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a TrafficController @@ -126,9 +131,10 @@ func (client *TrafficControllerInterfaceClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TrafficControllerInterfaceClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TrafficControllerInterfaceClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[TrafficControllerInterfaceClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,18 +145,20 @@ func (client *TrafficControllerInterfaceClient) BeginDelete(ctx context.Context, // // Generated from API version 2023-05-01-preview func (client *TrafficControllerInterfaceClient) deleteOperation(ctx context.Context, resourceGroupName string, trafficControllerName string, options *TrafficControllerInterfaceClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, trafficControllerName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -188,18 +196,21 @@ func (client *TrafficControllerInterfaceClient) deleteCreateRequest(ctx context. // - options - TrafficControllerInterfaceClientGetOptions contains the optional parameters for the TrafficControllerInterfaceClient.Get // method. func (client *TrafficControllerInterfaceClient) Get(ctx context.Context, resourceGroupName string, trafficControllerName string, options *TrafficControllerInterfaceClientGetOptions) (TrafficControllerInterfaceClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, trafficControllerName, options) if err != nil { return TrafficControllerInterfaceClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TrafficControllerInterfaceClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TrafficControllerInterfaceClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TrafficControllerInterfaceClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -372,18 +383,21 @@ func (client *TrafficControllerInterfaceClient) listBySubscriptionHandleResponse // - options - TrafficControllerInterfaceClientUpdateOptions contains the optional parameters for the TrafficControllerInterfaceClient.Update // method. func (client *TrafficControllerInterfaceClient) Update(ctx context.Context, resourceGroupName string, trafficControllerName string, properties TrafficControllerUpdate, options *TrafficControllerInterfaceClientUpdateOptions) (TrafficControllerInterfaceClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, trafficControllerName, properties, options) if err != nil { return TrafficControllerInterfaceClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TrafficControllerInterfaceClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TrafficControllerInterfaceClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TrafficControllerInterfaceClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -409,7 +423,10 @@ func (client *TrafficControllerInterfaceClient) updateCreateRequest(ctx context. reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client_example_test.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client_example_test.go deleted file mode 100644 index 5e462e2d3e7b..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client_example_test.go +++ /dev/null @@ -1,279 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armservicenetworking_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/armservicenetworking" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllersGetList.json -func ExampleTrafficControllerInterfaceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTrafficControllerInterfaceClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TrafficControllerListResult = armservicenetworking.TrafficControllerListResult{ - // Value: []*armservicenetworking.TrafficController{ - // { - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllersGet.json -func ExampleTrafficControllerInterfaceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTrafficControllerInterfaceClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TrafficControllerListResult = armservicenetworking.TrafficControllerListResult{ - // Value: []*armservicenetworking.TrafficController{ - // { - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerGet.json -func ExampleTrafficControllerInterfaceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTrafficControllerInterfaceClient().Get(ctx, "rg1", "tc1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TrafficController = armservicenetworking.TrafficController{ - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerPut.json -func ExampleTrafficControllerInterfaceClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTrafficControllerInterfaceClient().BeginCreateOrUpdate(ctx, "rg1", "tc1", armservicenetworking.TrafficController{ - Location: to.Ptr("NorthCentralUS"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TrafficController = armservicenetworking.TrafficController{ - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerPatch.json -func ExampleTrafficControllerInterfaceClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTrafficControllerInterfaceClient().Update(ctx, "rg1", "tc1", armservicenetworking.TrafficControllerUpdate{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TrafficController = armservicenetworking.TrafficController{ - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerDelete.json -func ExampleTrafficControllerInterfaceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTrafficControllerInterfaceClient().BeginDelete(ctx, "rg1", "tc1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -}