From 14292a3c0fe2e075b8efee5e4470984f90513703 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 26 Aug 2022 17:42:01 +0000 Subject: [PATCH] CodeGen from PR 20414 in Azure/azure-rest-api-specs Merge e17f533db77eaa2e1c1cea3622fb4512902f81de into 152050002a09b76fd66ddb82dd9e90a41d87906c --- .../armnetworkfunction/CHANGELOG.md | 16 ++ .../armnetworkfunction/autorest.md | 6 +- .../azuretrafficcollectors_client.go | 20 +-- ...retrafficcollectors_client_example_test.go | 127 ---------------- ...trafficcollectorsbyresourcegroup_client.go | 4 +- ...torsbyresourcegroup_client_example_test.go | 42 ------ ...etrafficcollectorsbysubscription_client.go | 4 +- ...ctorsbysubscription_client_example_test.go | 41 ------ .../armnetworkfunction/client.go | 4 +- .../collectorpolicies_client.go | 20 +-- .../collectorpolicies_client_example_test.go | 139 ------------------ .../armnetworkfunction/constants.go | 17 ++- .../networkfunction/armnetworkfunction/go.mod | 16 +- .../networkfunction/armnetworkfunction/go.sum | 24 +-- .../armnetworkfunction/models.go | 32 ++-- .../armnetworkfunction/models_serde.go | 51 +------ .../networkfunction_client_example_test.go | 41 ------ 17 files changed, 86 insertions(+), 518 deletions(-) delete mode 100644 sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectors_client_example_test.go delete mode 100644 sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbyresourcegroup_client_example_test.go delete mode 100644 sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbysubscription_client_example_test.go delete mode 100644 sdk/resourcemanager/networkfunction/armnetworkfunction/collectorpolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/networkfunction/armnetworkfunction/networkfunction_client_example_test.go diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/CHANGELOG.md b/sdk/resourcemanager/networkfunction/armnetworkfunction/CHANGELOG.md index c625671e2fe1..d5c335243e8a 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/CHANGELOG.md +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 2.0.0 (2022-08-26) +### Breaking Changes + +- Type of `CollectorPolicy.SystemData` has been changed from `*CollectorPolicySystemData` to `*TrackedResourceSystemData` +- Struct `CollectorPolicySystemData` has been removed + +### Features Added + +- New const `APIVersionParameterTwoThousandTwentyTwo0801` +- New const `APIVersionParameterTwoThousandTwentyTwo0501` +- New type alias `APIVersionParameter` +- New function `PossibleAPIVersionParameterValues() []APIVersionParameter` +- New field `Tags` in struct `CollectorPolicy` +- New field `Location` in struct `CollectorPolicy` + + ## 1.0.0 (2022-07-07) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkfunction/armnetworkfunction` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/autorest.md b/sdk/resourcemanager/networkfunction/armnetworkfunction/autorest.md index 858638082c62..1ac1e57fa4fb 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/autorest.md +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/898587c563d7b1941e1a10779ea7b122dce8ad6f/specification/networkfunction/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/898587c563d7b1941e1a10779ea7b122dce8ad6f/specification/networkfunction/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/networkfunction/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/networkfunction/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectors_client.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectors_client.go index 39786b9ee1f7..03aab678ae3a 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectors_client.go +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectors_client.go @@ -57,7 +57,7 @@ func NewAzureTrafficCollectorsClient(subscriptionID string, credential azcore.To // BeginCreateOrUpdate - Creates or updates a Azure Traffic Collector resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // azureTrafficCollectorName - Azure Traffic Collector name // parameters - The parameters to provide for the created Azure Traffic Collector. @@ -79,7 +79,7 @@ func (client *AzureTrafficCollectorsClient) BeginCreateOrUpdate(ctx context.Cont // CreateOrUpdate - Creates or updates a Azure Traffic Collector resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 func (client *AzureTrafficCollectorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, azureTrafficCollectorName string, parameters AzureTrafficCollector, options *AzureTrafficCollectorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, azureTrafficCollectorName, parameters, options) if err != nil { @@ -115,7 +115,7 @@ func (client *AzureTrafficCollectorsClient) createOrUpdateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -123,7 +123,7 @@ func (client *AzureTrafficCollectorsClient) createOrUpdateCreateRequest(ctx cont // BeginDelete - Deletes a specified Azure Traffic Collector resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // azureTrafficCollectorName - Azure Traffic Collector name // options - AzureTrafficCollectorsClientBeginDeleteOptions contains the optional parameters for the AzureTrafficCollectorsClient.BeginDelete @@ -144,7 +144,7 @@ func (client *AzureTrafficCollectorsClient) BeginDelete(ctx context.Context, res // Delete - Deletes a specified Azure Traffic Collector resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 func (client *AzureTrafficCollectorsClient) deleteOperation(ctx context.Context, resourceGroupName string, azureTrafficCollectorName string, options *AzureTrafficCollectorsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureTrafficCollectorName, options) if err != nil { @@ -180,7 +180,7 @@ func (client *AzureTrafficCollectorsClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +188,7 @@ func (client *AzureTrafficCollectorsClient) deleteCreateRequest(ctx context.Cont // Get - Gets the specified Azure Traffic Collector in a specified resource group // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // azureTrafficCollectorName - Azure Traffic Collector name // options - AzureTrafficCollectorsClientGetOptions contains the optional parameters for the AzureTrafficCollectorsClient.Get @@ -228,7 +228,7 @@ func (client *AzureTrafficCollectorsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,7 +245,7 @@ func (client *AzureTrafficCollectorsClient) getHandleResponse(resp *http.Respons // UpdateTags - Updates the specified Azure Traffic Collector tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // azureTrafficCollectorName - Azure Traffic Collector name // parameters - Parameters supplied to update Azure Traffic Collector tags. @@ -286,7 +286,7 @@ func (client *AzureTrafficCollectorsClient) updateTagsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectors_client_example_test.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectors_client_example_test.go deleted file mode 100644 index 62e889b0b76f..000000000000 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectors_client_example_test.go +++ /dev/null @@ -1,127 +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. - -package armnetworkfunction_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/networkfunction/armnetworkfunction" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorGet.json -func ExampleAzureTrafficCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewAzureTrafficCollectorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "atc", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorCreate.json -func ExampleAzureTrafficCollectorsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewAzureTrafficCollectorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "atc", - armnetworkfunction.AzureTrafficCollector{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetworkfunction.AzureTrafficCollectorPropertiesFormat{ - CollectorPolicies: []*armnetworkfunction.CollectorPolicy{}, - }, - }, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorDelete.json -func ExampleAzureTrafficCollectorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewAzureTrafficCollectorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "atc", - 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorUpdateTags.json -func ExampleAzureTrafficCollectorsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewAzureTrafficCollectorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.UpdateTags(ctx, - "rg1", - "atc", - armnetworkfunction.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbyresourcegroup_client.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbyresourcegroup_client.go index 26e930fe9452..c0129b8d589e 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbyresourcegroup_client.go +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbyresourcegroup_client.go @@ -57,7 +57,7 @@ func NewAzureTrafficCollectorsByResourceGroupClient(subscriptionID string, crede // NewListPager - Return list of Azure Traffic Collectors in a Resource Group // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // options - AzureTrafficCollectorsByResourceGroupClientListOptions contains the optional parameters for the AzureTrafficCollectorsByResourceGroupClient.List // method. @@ -105,7 +105,7 @@ func (client *AzureTrafficCollectorsByResourceGroupClient) listCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbyresourcegroup_client_example_test.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbyresourcegroup_client_example_test.go deleted file mode 100644 index 77249aec036e..000000000000 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbyresourcegroup_client_example_test.go +++ /dev/null @@ -1,42 +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. - -package armnetworkfunction_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkfunction/armnetworkfunction" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorsByResourceGroupList.json -func ExampleAzureTrafficCollectorsByResourceGroupClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewAzureTrafficCollectorsByResourceGroupClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rg1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbysubscription_client.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbysubscription_client.go index 92772ccb191e..16c599d91af3 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbysubscription_client.go +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbysubscription_client.go @@ -57,7 +57,7 @@ func NewAzureTrafficCollectorsBySubscriptionClient(subscriptionID string, creden // NewListPager - Return list of Azure Traffic Collectors in a subscription // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // options - AzureTrafficCollectorsBySubscriptionClientListOptions contains the optional parameters for the AzureTrafficCollectorsBySubscriptionClient.List // method. func (client *AzureTrafficCollectorsBySubscriptionClient) NewListPager(options *AzureTrafficCollectorsBySubscriptionClientListOptions) *runtime.Pager[AzureTrafficCollectorsBySubscriptionClientListResponse] { @@ -100,7 +100,7 @@ func (client *AzureTrafficCollectorsBySubscriptionClient) listCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbysubscription_client_example_test.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbysubscription_client_example_test.go deleted file mode 100644 index 35c7f1bad25e..000000000000 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/azuretrafficcollectorsbysubscription_client_example_test.go +++ /dev/null @@ -1,41 +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. - -package armnetworkfunction_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkfunction/armnetworkfunction" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorsBySubscriptionList.json -func ExampleAzureTrafficCollectorsBySubscriptionClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewAzureTrafficCollectorsBySubscriptionClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/client.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/client.go index 52c4926fef5e..215e83f9c85c 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/client.go +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/client.go @@ -51,7 +51,7 @@ func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (* // NewListOperationsPager - Lists all of the available NetworkFunction Rest API operations. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // options - ClientListOperationsOptions contains the optional parameters for the Client.ListOperations method. func (client *Client) NewListOperationsPager(options *ClientListOperationsOptions) *runtime.Pager[ClientListOperationsResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListOperationsResponse]{ @@ -83,7 +83,7 @@ func (client *Client) listOperationsCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/collectorpolicies_client.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/collectorpolicies_client.go index f0ca8f5dd232..0a9895b3d9ee 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/collectorpolicies_client.go +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/collectorpolicies_client.go @@ -57,7 +57,7 @@ func NewCollectorPoliciesClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - Creates or updates a Collector Policy resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // azureTrafficCollectorName - Azure Traffic Collector name // collectorPolicyName - Collector Policy Name @@ -80,7 +80,7 @@ func (client *CollectorPoliciesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Creates or updates a Collector Policy resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 func (client *CollectorPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, azureTrafficCollectorName string, collectorPolicyName string, parameters CollectorPolicy, options *CollectorPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters, options) if err != nil { @@ -120,7 +120,7 @@ func (client *CollectorPoliciesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -128,7 +128,7 @@ func (client *CollectorPoliciesClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - Deletes a specified Collector Policy resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // azureTrafficCollectorName - Azure Traffic Collector name // collectorPolicyName - Collector Policy Name @@ -150,7 +150,7 @@ func (client *CollectorPoliciesClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a specified Collector Policy resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 func (client *CollectorPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, azureTrafficCollectorName string, collectorPolicyName string, options *CollectorPoliciesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureTrafficCollectorName, collectorPolicyName, options) if err != nil { @@ -190,7 +190,7 @@ func (client *CollectorPoliciesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,7 +198,7 @@ func (client *CollectorPoliciesClient) deleteCreateRequest(ctx context.Context, // Get - Gets the collector policy in a specified Traffic Collector // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // azureTrafficCollectorName - Azure Traffic Collector name // collectorPolicyName - Collector Policy Name @@ -242,7 +242,7 @@ func (client *CollectorPoliciesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +259,7 @@ func (client *CollectorPoliciesClient) getHandleResponse(resp *http.Response) (C // NewListPager - Return list of Collector policies in a Azure Traffic Collector // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-08-01 // resourceGroupName - The name of the resource group. // azureTrafficCollectorName - Azure Traffic Collector name // options - CollectorPoliciesClientListOptions contains the optional parameters for the CollectorPoliciesClient.List method. @@ -311,7 +311,7 @@ func (client *CollectorPoliciesClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/collectorpolicies_client_example_test.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/collectorpolicies_client_example_test.go deleted file mode 100644 index 07e9856e6832..000000000000 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/collectorpolicies_client_example_test.go +++ /dev/null @@ -1,139 +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. - -package armnetworkfunction_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/networkfunction/armnetworkfunction" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPoliciesList.json -func ExampleCollectorPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewCollectorPoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rg1", - "atc", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyGet.json -func ExampleCollectorPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewCollectorPoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "atc", - "cp1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyCreate.json -func ExampleCollectorPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewCollectorPoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "atc", - "cp1", - armnetworkfunction.CollectorPolicy{ - Properties: &armnetworkfunction.CollectorPolicyPropertiesFormat{ - EmissionPolicies: []*armnetworkfunction.EmissionPoliciesPropertiesFormat{ - { - EmissionDestinations: []*armnetworkfunction.EmissionPolicyDestination{ - { - DestinationType: to.Ptr(armnetworkfunction.DestinationTypeAzureMonitor), - }}, - EmissionType: to.Ptr(armnetworkfunction.EmissionTypeIPFIX), - }}, - IngestionPolicy: &armnetworkfunction.IngestionPolicyPropertiesFormat{ - IngestionSources: []*armnetworkfunction.IngestionSourcesPropertiesFormat{ - { - ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName"), - SourceType: to.Ptr(armnetworkfunction.SourceTypeResource), - }}, - IngestionType: to.Ptr(armnetworkfunction.IngestionTypeIPFIX), - }, - }, - }, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyDelete.json -func ExampleCollectorPoliciesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewCollectorPoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "atc", - "cp1", - 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/networkfunction/armnetworkfunction/constants.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/constants.go index b3c947ce1c24..9dca2ca9e2f4 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/constants.go +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/constants.go @@ -11,9 +11,24 @@ package armnetworkfunction const ( moduleName = "armnetworkfunction" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) +type APIVersionParameter string + +const ( + APIVersionParameterTwoThousandTwentyTwo0501 APIVersionParameter = "2022-05-01" + APIVersionParameterTwoThousandTwentyTwo0801 APIVersionParameter = "2022-08-01" +) + +// PossibleAPIVersionParameterValues returns the possible values for the APIVersionParameter const type. +func PossibleAPIVersionParameterValues() []APIVersionParameter { + return []APIVersionParameter{ + APIVersionParameterTwoThousandTwentyTwo0501, + APIVersionParameterTwoThousandTwentyTwo0801, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/go.mod b/sdk/resourcemanager/networkfunction/armnetworkfunction/go.mod index a6f79493b463..05c310aac8d5 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/go.mod +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkfunction/armnetworkfunction +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkfunction/armnetworkfunction/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/go.sum b/sdk/resourcemanager/networkfunction/armnetworkfunction/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/go.sum +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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 v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +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.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +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/networkfunction/armnetworkfunction/models.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/models.go index b60283922728..9237d04b03ae 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/models.go +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/models.go @@ -148,22 +148,28 @@ type CollectorPoliciesClientListOptions struct { // CollectorPolicy - Collector policy resource. type CollectorPolicy struct { + // Resource location. + Location *string `json:"location,omitempty"` + // Properties of the Collector Policy. Properties *CollectorPolicyPropertiesFormat `json:"properties,omitempty"` + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty" azure:"ro"` - // READ-ONLY; Azure resource Id + // READ-ONLY; Resource ID. ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; Azure resource name + // READ-ONLY; Resource name. Name *string `json:"name,omitempty" azure:"ro"` // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *CollectorPolicySystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *TrackedResourceSystemData `json:"systemData,omitempty" azure:"ro"` - // READ-ONLY; Azure resource type + // READ-ONLY; Resource type. Type *string `json:"type,omitempty" azure:"ro"` } @@ -188,24 +194,6 @@ type CollectorPolicyPropertiesFormat struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// CollectorPolicySystemData - Metadata pertaining to creation and last modification of the resource. -type CollectorPolicySystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` - - // The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - - // The type of identity that created the resource. - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - - // The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - // EmissionPoliciesPropertiesFormat - Emission policy properties. type EmissionPoliciesPropertiesFormat struct { // Emission policy destinations. diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/models_serde.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/models_serde.go index 75e0b627c14b..c542936aee3b 100644 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/models_serde.go +++ b/sdk/resourcemanager/networkfunction/armnetworkfunction/models_serde.go @@ -208,9 +208,11 @@ func (c CollectorPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "etag", c.Etag) populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } @@ -230,6 +232,9 @@ func (c *CollectorPolicy) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) @@ -239,6 +244,9 @@ func (c *CollectorPolicy) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &c.SystemData) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) @@ -316,49 +324,6 @@ func (c *CollectorPolicyPropertiesFormat) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CollectorPolicySystemData. -func (c CollectorPolicySystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", c.CreatedAt) - populate(objectMap, "createdBy", c.CreatedBy) - populate(objectMap, "createdByType", c.CreatedByType) - populate(objectMap, "lastModifiedBy", c.LastModifiedBy) - populate(objectMap, "lastModifiedByType", c.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CollectorPolicySystemData. -func (c *CollectorPolicySystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &c.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &c.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &c.CreatedByType) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &c.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &c.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type EmissionPoliciesPropertiesFormat. func (e EmissionPoliciesPropertiesFormat) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) diff --git a/sdk/resourcemanager/networkfunction/armnetworkfunction/networkfunction_client_example_test.go b/sdk/resourcemanager/networkfunction/armnetworkfunction/networkfunction_client_example_test.go deleted file mode 100644 index f8e370076ca5..000000000000 --- a/sdk/resourcemanager/networkfunction/armnetworkfunction/networkfunction_client_example_test.go +++ /dev/null @@ -1,41 +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. - -package armnetworkfunction_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkfunction/armnetworkfunction" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/OperationsList.json -func ExampleClient_NewListOperationsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetworkfunction.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOperationsPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -}