diff --git a/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md b/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md index 06d55e1347e8..fd61395a90ff 100644 --- a/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md +++ b/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md @@ -1,5 +1,39 @@ # Release History +## 3.1.0-beta.3 (2025-04-29) +### Breaking Changes + +- Function `*APIKeysClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, *APIKeysClientCreateOrUpdateOptions)` to `(context.Context, string, string, string, DeploymentAPIKeyResponse, *APIKeysClientCreateOrUpdateOptions)` +- Function `*CertificatesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, *CertificatesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, string, Certificate, *CertificatesClientBeginCreateOrUpdateOptions)` +- Function `*ConfigurationsClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, *ConfigurationsClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, string, ConfigurationResponse, *ConfigurationsClientBeginCreateOrUpdateOptions)` +- Function `*DeploymentsClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, Deployment, *DeploymentsClientBeginCreateOrUpdateOptions)` +- Function `*DeploymentsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsClientBeginUpdateOptions)` to `(context.Context, string, string, DeploymentUpdateParameters, *DeploymentsClientBeginUpdateOptions)` +- Type of `Deployment.SKU` has been changed from `*ResourceSKU` to `*AzureResourceManagerResourceSKUProperty` +- Type of `DeploymentUpdateParameters.SKU` has been changed from `*ResourceSKU` to `*AzureResourceManagerResourceSKUProperty` +- Type of `OperationListResult.Value` has been changed from `[]*OperationResult` to `[]*Operation` +- Struct `ConfigurationRequest` has been removed +- Struct `ConfigurationRequestProperties` has been removed +- Struct `DeploymentAPIKeyRequest` has been removed +- Struct `DeploymentAPIKeyRequestProperties` has been removed +- Struct `OperationResult` has been removed +- Struct `ResourceSKU` has been removed +- Field `Body` of struct `APIKeysClientCreateOrUpdateOptions` has been removed +- Field `Body` of struct `CertificatesClientBeginCreateOrUpdateOptions` has been removed +- Field `Body` of struct `ConfigurationsClientBeginCreateOrUpdateOptions` has been removed +- Field `Body` of struct `DeploymentsClientBeginCreateOrUpdateOptions` has been removed +- Field `Body` of struct `DeploymentsClientBeginUpdateOptions` has been removed + +### Features Added + +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `SKUTier` with values `SKUTierBasic`, `SKUTierFree`, `SKUTierPremium`, `SKUTierStandard` +- New struct `AzureResourceManagerResourceSKUProperty` +- New struct `Operation` +- New struct `SKU` +- New field `SystemData` in struct `DeploymentAPIKeyResponse` + + ## 3.1.0-beta.2 (2025-02-27) ### Breaking Changes diff --git a/sdk/resourcemanager/nginx/armnginx/apikeys_client.go b/sdk/resourcemanager/nginx/armnginx/apikeys_client.go index 5a26e1db827d..f16d43b0a158 100644 --- a/sdk/resourcemanager/nginx/armnginx/apikeys_client.go +++ b/sdk/resourcemanager/nginx/armnginx/apikeys_client.go @@ -1,6 +1,3 @@ -//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. @@ -50,14 +47,15 @@ func NewAPIKeysClient(subscriptionID string, credential azcore.TokenCredential, // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - apiKeyName - The resource name of the API key +// - body - The API Key object containing fields (e.g. secret text, expiration date) to upsert the key. // - options - APIKeysClientCreateOrUpdateOptions contains the optional parameters for the APIKeysClient.CreateOrUpdate method. -func (client *APIKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientCreateOrUpdateOptions) (APIKeysClientCreateOrUpdateResponse, error) { +func (client *APIKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, body DeploymentAPIKeyResponse, options *APIKeysClientCreateOrUpdateOptions) (APIKeysClientCreateOrUpdateResponse, error) { var err error const operationName = "APIKeysClient.CreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, apiKeyName, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, apiKeyName, body, options) if err != nil { return APIKeysClientCreateOrUpdateResponse{}, err } @@ -74,7 +72,7 @@ func (client *APIKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupNa } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *APIKeysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *APIKeysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, body DeploymentAPIKeyResponse, _ *APIKeysClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -100,11 +98,8 @@ func (client *APIKeysClient) createOrUpdateCreateRequest(ctx context.Context, re reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } @@ -148,7 +143,7 @@ func (client *APIKeysClient) Delete(ctx context.Context, resourceGroupName strin } // deleteCreateRequest creates the Delete request. -func (client *APIKeysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientDeleteOptions) (*policy.Request, error) { +func (client *APIKeysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, _ *APIKeysClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -208,7 +203,7 @@ func (client *APIKeysClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *APIKeysClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientGetOptions) (*policy.Request, error) { +func (client *APIKeysClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, _ *APIKeysClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -276,7 +271,7 @@ func (client *APIKeysClient) NewListPager(resourceGroupName string, deploymentNa } // listCreateRequest creates the List request. -func (client *APIKeysClient) listCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *APIKeysClientListOptions) (*policy.Request, error) { +func (client *APIKeysClient) listCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, _ *APIKeysClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/nginx/armnginx/apikeys_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/apikeys_client_example_test.go deleted file mode 100644 index 470b1e33a188..000000000000 --- a/sdk/resourcemanager/nginx/armnginx/apikeys_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. -// DO NOT EDIT. - -package armnginx_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_CreateOrUpdate.json -func ExampleAPIKeysClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIKeysClient().CreateOrUpdate(ctx, "myResourceGroup", "myDeployment", "myApiKey", &armnginx.APIKeysClientCreateOrUpdateOptions{Body: 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.DeploymentAPIKeyResponse = armnginx.DeploymentAPIKeyResponse{ - // Name: to.Ptr("myApiKey"), - // Type: to.Ptr("Nginx.NginxPlus/nginxDeployments/apiKeys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/NGINX.NGINXPLUS/nginxDeployments/myDeployment/apiKeys/myApiKey"), - // Properties: &armnginx.DeploymentAPIKeyResponseProperties{ - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-09-01T00:00:00.000Z"); return t}()), - // Hint: to.Ptr("000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Delete.json -func ExampleAPIKeysClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIKeysClient().Delete(ctx, "myResourceGroup", "myDeployment", "myApiKey", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Get.json -func ExampleAPIKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIKeysClient().Get(ctx, "myResourceGroup", "myDeployment", "myApiKey", 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.DeploymentAPIKeyResponse = armnginx.DeploymentAPIKeyResponse{ - // Name: to.Ptr("myApiKey"), - // Type: to.Ptr("Nginx.NginxPlus/nginxDeployments/apiKeys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/apiKeys/myApiKey"), - // Properties: &armnginx.DeploymentAPIKeyResponseProperties{ - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-09-01T00:00:00.000Z"); return t}()), - // Hint: to.Ptr("000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_List.json -func ExampleAPIKeysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIKeysClient().NewListPager("myResourceGroup", "myDeployment", 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.DeploymentAPIKeyListResponse = armnginx.DeploymentAPIKeyListResponse{ - // Value: []*armnginx.DeploymentAPIKeyResponse{ - // { - // Name: to.Ptr("myApiKey"), - // Type: to.Ptr("Nginx.NginxPlus/nginxDeployments/apiKeys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/apiKeys/myApiKey"), - // Properties: &armnginx.DeploymentAPIKeyResponseProperties{ - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-09-01T00:00:00.000Z"); return t}()), - // Hint: to.Ptr("000"), - // }, - // }, - // { - // Name: to.Ptr("myApiKey2"), - // Type: to.Ptr("Nginx.NginxPlus/nginxDeployments/apiKeys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/apiKeys/myApiKey2"), - // Properties: &armnginx.DeploymentAPIKeyResponseProperties{ - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-01T00:00:00.000Z"); return t}()), - // Hint: to.Ptr("111"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/nginx/armnginx/autorest.md b/sdk/resourcemanager/nginx/armnginx/autorest.md index d63c4af7fc14..f43e092fdff6 100644 --- a/sdk/resourcemanager/nginx/armnginx/autorest.md +++ b/sdk/resourcemanager/nginx/armnginx/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/nginx/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/nginx/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 3.1.0-beta.2 -tag: package-2024-11-01-preview +module-version: 3.1.0-beta.3 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/nginx/armnginx/certificates_client.go b/sdk/resourcemanager/nginx/armnginx/certificates_client.go index eeb09f525936..13d9905257af 100644 --- a/sdk/resourcemanager/nginx/armnginx/certificates_client.go +++ b/sdk/resourcemanager/nginx/armnginx/certificates_client.go @@ -1,6 +1,3 @@ -//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. @@ -50,11 +47,12 @@ func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredent // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - certificateName - The name of certificate +// - body - The certificate // - options - CertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.BeginCreateOrUpdate // method. -func (client *CertificatesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *CertificatesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CertificatesClientCreateOrUpdateResponse], error) { +func (client *CertificatesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, body Certificate, options *CertificatesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CertificatesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, deploymentName, certificateName, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, deploymentName, certificateName, body, options) if err != nil { return nil, err } @@ -74,13 +72,13 @@ func (client *CertificatesClient) BeginCreateOrUpdate(ctx context.Context, resou // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-11-01-preview -func (client *CertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *CertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { +func (client *CertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, body Certificate, options *CertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CertificatesClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, certificateName, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, certificateName, body, options) if err != nil { return nil, err } @@ -96,7 +94,7 @@ func (client *CertificatesClient) createOrUpdate(ctx context.Context, resourceGr } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *CertificatesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, body Certificate, _ *CertificatesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,11 +120,8 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } @@ -147,7 +142,8 @@ func (client *CertificatesClient) BeginDelete(ctx context.Context, resourceGroup return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificatesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -183,7 +179,7 @@ func (client *CertificatesClient) deleteOperation(ctx context.Context, resourceG } // deleteCreateRequest creates the Delete request. -func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *CertificatesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, _ *CertificatesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -243,7 +239,7 @@ func (client *CertificatesClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *CertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *CertificatesClientGetOptions) (*policy.Request, error) { +func (client *CertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, _ *CertificatesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -311,7 +307,7 @@ func (client *CertificatesClient) NewListPager(resourceGroupName string, deploym } // listCreateRequest creates the List request. -func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *CertificatesClientListOptions) (*policy.Request, error) { +func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, _ *CertificatesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/nginx/armnginx/certificates_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/certificates_client_example_test.go deleted file mode 100644 index 54b4981be8ad..000000000000 --- a/sdk/resourcemanager/nginx/armnginx/certificates_client_example_test.go +++ /dev/null @@ -1,172 +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 armnginx_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Get.json -func ExampleCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().Get(ctx, "myResourceGroup", "myDeployment", "default", 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.Certificate = armnginx.Certificate{ - // Name: to.Ptr("default"), - // Type: to.Ptr("nginx.nginxplus/nginxdeployments/certificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/NGINX.NGINXPLUS/nginxDeployments/myDeployment/certificates/default"), - // Properties: &armnginx.CertificateProperties{ - // CertificateError: &armnginx.CertificateErrorResponseBody{ - // Code: to.Ptr("CertificateNotYetValid"), - // Message: to.Ptr("The certificate is not yet valid. The certificate is not yet valid. NotBefore: '2020-01-01T00:00:00Z', NotAfter: '2020-01-01T00:00:00Z'"), - // }, - // CertificateVirtualPath: to.Ptr("/src/cert/somePath.cert"), - // KeyVaultSecretCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T00:00:00.000Z"); return t}()), - // KeyVaultSecretID: to.Ptr("https://someKV.vault.azure.com/someSecretID"), - // KeyVaultSecretVersion: to.Ptr("12345678ef9a12345678ef9a12345678"), - // KeyVirtualPath: to.Ptr("/src/cert/somekey.key"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // SHA1Thumbprint: to.Ptr("1234567890ABCDEF1234567890ABCDEF12345678"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_CreateOrUpdate.json -func ExampleCertificatesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCertificatesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDeployment", "default", &armnginx.CertificatesClientBeginCreateOrUpdateOptions{Body: 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.Certificate = armnginx.Certificate{ - // Name: to.Ptr("default"), - // Type: to.Ptr("nginx.nginxplus/nginxdeployments/certificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/NGINX.NGINXPLUS/nginxDeployments/myDeployment/certificates/default"), - // Properties: &armnginx.CertificateProperties{ - // CertificateVirtualPath: to.Ptr("/src/cert/somePath.cert"), - // KeyVaultSecretID: to.Ptr("https://someKV.vault.azure.com/someSecretID"), - // KeyVirtualPath: to.Ptr("/src/cert/somekey.key"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Delete.json -func ExampleCertificatesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCertificatesClient().BeginDelete(ctx, "myResourceGroup", "myDeployment", "default", 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/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_List.json -func ExampleCertificatesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCertificatesClient().NewListPager("myResourceGroup", "myDeployment", 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.CertificateListResponse = armnginx.CertificateListResponse{ - // Value: []*armnginx.Certificate{ - // { - // Name: to.Ptr("cert1"), - // Type: to.Ptr("nginx.nginxplus/nginxdeployments/certificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/NGINX.NGINXPLUS/nginxDeployments/myDeployment/certificates/cert1"), - // Properties: &armnginx.CertificateProperties{ - // CertificateError: &armnginx.CertificateErrorResponseBody{ - // Code: to.Ptr("CertificateNotYetValid"), - // Message: to.Ptr("The certificate is not yet valid. The certificate is not yet valid. NotBefore: '2020-01-01T00:00:00Z', NotAfter: '2020-01-01T00:00:00Z'"), - // }, - // CertificateVirtualPath: to.Ptr("/src/cert/somePath.cert"), - // KeyVaultSecretCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T00:00:00.000Z"); return t}()), - // KeyVaultSecretID: to.Ptr("https://someKV.vault.azure.com/someSecretID"), - // KeyVaultSecretVersion: to.Ptr("12345678ef9a12345678ef9a12345678"), - // KeyVirtualPath: to.Ptr("/src/cert/somekey.key"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // SHA1Thumbprint: to.Ptr("1234567890ABCDEF1234567890ABCDEF12345678"), - // }, - // }, - // { - // Name: to.Ptr("cert2"), - // Type: to.Ptr("nginx.nginxplus/nginxdeployments/certificates"), - // ID: to.Ptr("/subscritions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/NGINX.NGINXPLUS/nginxDeployments/myDeployment/certificates/cert2"), - // Properties: &armnginx.CertificateProperties{ - // CertificateVirtualPath: to.Ptr("/src/cert/somePath2.cert"), - // KeyVaultSecretCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T00:00:00.000Z"); return t}()), - // KeyVaultSecretID: to.Ptr("https://someKV.vault.azure.com/someSecretID2"), - // KeyVaultSecretVersion: to.Ptr("12345678ef9a12345678ef9a12345678"), - // KeyVirtualPath: to.Ptr("/src/cert/somekey2.key"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // SHA1Thumbprint: to.Ptr("1234567890ABCDEF1234567890ABCDEF12345678"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/nginx/armnginx/client_factory.go b/sdk/resourcemanager/nginx/armnginx/client_factory.go index 93f042ea41fd..ebc3f7519559 100644 --- a/sdk/resourcemanager/nginx/armnginx/client_factory.go +++ b/sdk/resourcemanager/nginx/armnginx/client_factory.go @@ -1,6 +1,3 @@ -//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. diff --git a/sdk/resourcemanager/nginx/armnginx/configurations_client.go b/sdk/resourcemanager/nginx/armnginx/configurations_client.go index 9324b9f1e0ef..6c80c2c77b47 100644 --- a/sdk/resourcemanager/nginx/armnginx/configurations_client.go +++ b/sdk/resourcemanager/nginx/armnginx/configurations_client.go @@ -1,6 +1,3 @@ -//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. @@ -125,11 +122,12 @@ func (client *ConfigurationsClient) analysisHandleResponse(resp *http.Response) // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - configurationName - The name of configuration, only 'default' is supported value due to the singleton of NGINX conf +// - body - The NGINX configuration // - options - ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate // method. -func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConfigurationsClientCreateOrUpdateResponse], error) { +func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, body ConfigurationResponse, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConfigurationsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, deploymentName, configurationName, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, deploymentName, configurationName, body, options) if err != nil { return nil, err } @@ -149,13 +147,13 @@ func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, res // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-11-01-preview -func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, body ConfigurationResponse, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationsClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, configurationName, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, configurationName, body, options) if err != nil { return nil, err } @@ -171,7 +169,7 @@ func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resource } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, body ConfigurationResponse, _ *ConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -197,11 +195,8 @@ func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Cont reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } @@ -222,7 +217,8 @@ func (client *ConfigurationsClient) BeginDelete(ctx context.Context, resourceGro return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -258,7 +254,7 @@ func (client *ConfigurationsClient) deleteOperation(ctx context.Context, resourc } // deleteCreateRequest creates the Delete request. -func (client *ConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, _ *ConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -318,7 +314,7 @@ func (client *ConfigurationsClient) Get(ctx context.Context, resourceGroupName s } // getCreateRequest creates the Get request. -func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientGetOptions) (*policy.Request, error) { +func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, _ *ConfigurationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -386,7 +382,7 @@ func (client *ConfigurationsClient) NewListPager(resourceGroupName string, deplo } // listCreateRequest creates the List request. -func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *ConfigurationsClientListOptions) (*policy.Request, error) { +func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, _ *ConfigurationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/nginx/armnginx/configurations_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/configurations_client_example_test.go deleted file mode 100644 index 2bb432ba058f..000000000000 --- a/sdk/resourcemanager/nginx/armnginx/configurations_client_example_test.go +++ /dev/null @@ -1,204 +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 armnginx_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_List.json -func ExampleConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationsClient().NewListPager("myResourceGroup", "myDeployment", 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.ConfigurationListResponse = armnginx.ConfigurationListResponse{ - // Value: []*armnginx.ConfigurationResponse{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("nginx.nginxplus/nginxDeployments/configurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/configurations/default"), - // Properties: &armnginx.ConfigurationResponseProperties{ - // Files: []*armnginx.ConfigurationFile{ - // { - // Content: to.Ptr("ABCDEF=="), - // VirtualPath: to.Ptr("/etc/nginx/nginx.conf"), - // }}, - // Package: &armnginx.ConfigurationPackage{ - // }, - // ProtectedFiles: []*armnginx.ConfigurationProtectedFileResponse{ - // { - // ContentHash: to.Ptr("sha256:1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF"), - // VirtualPath: to.Ptr("/etc/nginx/protected-file.cert"), - // }}, - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // RootFile: to.Ptr("/etc/nginx/nginx.conf"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Get.json -func ExampleConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationsClient().Get(ctx, "myResourceGroup", "myDeployment", "default", 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.ConfigurationResponse = armnginx.ConfigurationResponse{ - // Name: to.Ptr("default"), - // Type: to.Ptr("nginx.nginxplus/nginxDeployments/configurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/configurations/default"), - // Properties: &armnginx.ConfigurationResponseProperties{ - // Files: []*armnginx.ConfigurationFile{ - // { - // Content: to.Ptr("ABCDEF=="), - // VirtualPath: to.Ptr("/etc/nginx/nginx.conf"), - // }}, - // Package: &armnginx.ConfigurationPackage{ - // }, - // ProtectedFiles: []*armnginx.ConfigurationProtectedFileResponse{ - // { - // ContentHash: to.Ptr("sha256:1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF"), - // VirtualPath: to.Ptr("/etc/nginx/protected-file.cert"), - // }}, - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // RootFile: to.Ptr("/etc/nginx/nginx.conf"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_CreateOrUpdate.json -func ExampleConfigurationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDeployment", "default", &armnginx.ConfigurationsClientBeginCreateOrUpdateOptions{Body: 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.ConfigurationResponse = armnginx.ConfigurationResponse{ - // Name: to.Ptr("default"), - // Type: to.Ptr("nginx.nginxplus/nginxDeployments/configurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/configurations/default"), - // Properties: &armnginx.ConfigurationResponseProperties{ - // Files: []*armnginx.ConfigurationFile{ - // { - // Content: to.Ptr("ABCDEF=="), - // VirtualPath: to.Ptr("/etc/nginx/nginx.conf"), - // }}, - // Package: &armnginx.ConfigurationPackage{ - // }, - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // RootFile: to.Ptr("/etc/nginx/nginx.conf"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Delete.json -func ExampleConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginDelete(ctx, "myResourceGroup", "myDeployment", "default", 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/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Analysis.json -func ExampleConfigurationsClient_Analysis() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationsClient().Analysis(ctx, "myResourceGroup", "myDeployment", "default", &armnginx.ConfigurationsClientAnalysisOptions{Body: 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.AnalysisResult = armnginx.AnalysisResult{ - // Data: &armnginx.AnalysisResultData{ - // Errors: []*armnginx.AnalysisDiagnostic{ - // { - // Description: to.Ptr("Directives outside the http context are not allowed"), - // Directive: to.Ptr("worker_processes"), - // File: to.Ptr("/etc/nginx/nginx.conf"), - // ID: to.Ptr("config-analysis-error-1"), - // Line: to.Ptr[float32](2), - // Message: to.Ptr("You are not allowed to set the worker_processes directive"), - // Rule: to.Ptr("nginx-azure-load-balancer-allowed-directives"), - // }}, - // }, - // Status: to.Ptr("FAILED"), - // } -} diff --git a/sdk/resourcemanager/nginx/armnginx/constants.go b/sdk/resourcemanager/nginx/armnginx/constants.go index 15032c4bae7c..470c42270534 100644 --- a/sdk/resourcemanager/nginx/armnginx/constants.go +++ b/sdk/resourcemanager/nginx/armnginx/constants.go @@ -1,6 +1,3 @@ -//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. @@ -10,9 +7,23 @@ package armnginx const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx" - moduleVersion = "v3.1.0-beta.2" + moduleVersion = "v3.1.0-beta.3" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" ) +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + // ActivationState - The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it. type ActivationState string @@ -99,6 +110,25 @@ func PossibleNginxPrivateIPAllocationMethodValues() []NginxPrivateIPAllocationMe } } +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + type ProvisioningState string const ( @@ -127,3 +157,24 @@ func PossibleProvisioningStateValues() []ProvisioningState { ProvisioningStateUpdating, } } + +// SKUTier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but +// is not required on a PUT. +type SKUTier string + +const ( + SKUTierBasic SKUTier = "Basic" + SKUTierFree SKUTier = "Free" + SKUTierPremium SKUTier = "Premium" + SKUTierStandard SKUTier = "Standard" +) + +// PossibleSKUTierValues returns the possible values for the SKUTier const type. +func PossibleSKUTierValues() []SKUTier { + return []SKUTier{ + SKUTierBasic, + SKUTierFree, + SKUTierPremium, + SKUTierStandard, + } +} diff --git a/sdk/resourcemanager/nginx/armnginx/deployments_client.go b/sdk/resourcemanager/nginx/armnginx/deployments_client.go index 12e1ce3b1365..f8cc70ec8f22 100644 --- a/sdk/resourcemanager/nginx/armnginx/deployments_client.go +++ b/sdk/resourcemanager/nginx/armnginx/deployments_client.go @@ -1,6 +1,3 @@ -//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. @@ -51,9 +48,9 @@ func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredenti // - deploymentName - The name of targeted NGINX deployment // - options - DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate // method. -func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateResponse], error) { +func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, body Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, deploymentName, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, deploymentName, body, options) if err != nil { return nil, err } @@ -73,13 +70,13 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-11-01-preview -func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, body Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DeploymentsClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, body, options) if err != nil { return nil, err } @@ -95,7 +92,7 @@ func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, body Deployment, _ *DeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -117,11 +114,8 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } @@ -140,7 +134,8 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -176,7 +171,7 @@ func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGr } // deleteCreateRequest creates the Delete request. -func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, _ *DeploymentsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -231,7 +226,7 @@ func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientGetOptions) (*policy.Request, error) { +func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, _ *DeploymentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -293,7 +288,7 @@ func (client *DeploymentsClient) NewListPager(options *DeploymentsClientListOpti } // listCreateRequest creates the List request. -func (client *DeploymentsClient) listCreateRequest(ctx context.Context, options *DeploymentsClientListOptions) (*policy.Request, error) { +func (client *DeploymentsClient) listCreateRequest(ctx context.Context, _ *DeploymentsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -349,7 +344,7 @@ func (client *DeploymentsClient) NewListByResourceGroupPager(resourceGroupName s } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *DeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *DeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -386,14 +381,15 @@ func (client *DeploymentsClient) listByResourceGroupHandleResponse(resp *http.Re // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - options - DeploymentsClientBeginUpdateOptions contains the optional parameters for the DeploymentsClient.BeginUpdate method. -func (client *DeploymentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginUpdateOptions) (*runtime.Poller[DeploymentsClientUpdateResponse], error) { +func (client *DeploymentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, deploymentName string, body DeploymentUpdateParameters, options *DeploymentsClientBeginUpdateOptions) (*runtime.Poller[DeploymentsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, deploymentName, options) + resp, err := client.update(ctx, resourceGroupName, deploymentName, body, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaOriginalURI, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -407,13 +403,13 @@ func (client *DeploymentsClient) BeginUpdate(ctx context.Context, resourceGroupN // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-11-01-preview -func (client *DeploymentsClient) update(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginUpdateOptions) (*http.Response, error) { +func (client *DeploymentsClient) update(ctx context.Context, resourceGroupName string, deploymentName string, body DeploymentUpdateParameters, options *DeploymentsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DeploymentsClient.BeginUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, deploymentName, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, deploymentName, body, options) if err != nil { return nil, err } @@ -429,7 +425,7 @@ func (client *DeploymentsClient) update(ctx context.Context, resourceGroupName s } // updateCreateRequest creates the Update request. -func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, body DeploymentUpdateParameters, _ *DeploymentsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -451,11 +447,8 @@ func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resour reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } diff --git a/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go deleted file mode 100644 index 31fd36db0099..000000000000 --- a/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go +++ /dev/null @@ -1,613 +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 armnginx_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get.json -func ExampleDeploymentsClient_Get_deploymentsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeploymentsClient().Get(ctx, "myResourceGroup", "myDeployment", 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.Deployment = armnginx.Deployment{ - // Name: to.Ptr("myDeployment"), - // Type: to.Ptr("nginx.nginxplus/deployments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment"), - // Location: to.Ptr("westus"), - // Properties: &armnginx.DeploymentProperties{ - // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ - // UpgradeChannel: to.Ptr("stable"), - // }, - // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), - // NetworkProfile: &armnginx.NetworkProfile{ - // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ - // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ - // { - // PrivateIPAddress: to.Ptr("1.1.1.1"), - // PrivateIPAllocationMethod: to.Ptr(armnginx.NginxPrivateIPAllocationMethodStatic), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }}, - // PublicIPAddresses: []*armnginx.PublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIPAddress"), - // }}, - // }, - // NetworkInterfaceConfiguration: &armnginx.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ - // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ - // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), - // }, - // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ - // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.21"), - // }, - // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.22"), - // }, - // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ - // WafEngineVersion: to.Ptr("10.624.0"), - // WafNginxVersion: to.Ptr("4.815.0"), - // }, - // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.23"), - // }, - // }, - // }, - // NginxVersion: to.Ptr("nginx-1.19.6"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // ScalingProperties: &armnginx.DeploymentScalingProperties{ - // Capacity: to.Ptr[int32](10), - // }, - // UserProfile: &armnginx.DeploymentUserProfile{ - // PreferredEmail: to.Ptr("example@example.email"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get_AutoScale.json -func ExampleDeploymentsClient_Get_deploymentsGetAutoScale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeploymentsClient().Get(ctx, "myResourceGroup", "myDeployment", 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.Deployment = armnginx.Deployment{ - // Name: to.Ptr("myDeployment"), - // Type: to.Ptr("nginx.nginxplus/deployments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment"), - // Location: to.Ptr("westus"), - // Properties: &armnginx.DeploymentProperties{ - // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ - // UpgradeChannel: to.Ptr("stable"), - // }, - // NetworkProfile: &armnginx.NetworkProfile{ - // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ - // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ - // { - // PrivateIPAddress: to.Ptr("1.1.1.1"), - // PrivateIPAllocationMethod: to.Ptr(armnginx.NginxPrivateIPAllocationMethodStatic), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }}, - // PublicIPAddresses: []*armnginx.PublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIPAddress"), - // }}, - // }, - // NetworkInterfaceConfiguration: &armnginx.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // NginxVersion: to.Ptr("nginx-1.19.6"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // ScalingProperties: &armnginx.DeploymentScalingProperties{ - // AutoScaleSettings: &armnginx.DeploymentScalingPropertiesAutoScaleSettings{ - // Profiles: []*armnginx.ScaleProfile{ - // { - // Name: to.Ptr("ExampleProfile"), - // Capacity: &armnginx.ScaleProfileCapacity{ - // Max: to.Ptr[int32](50), - // Min: to.Ptr[int32](10), - // }, - // }}, - // }, - // }, - // UserProfile: &armnginx.DeploymentUserProfile{ - // PreferredEmail: to.Ptr("example@example.email"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Create.json -func ExampleDeploymentsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeploymentsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDeployment", &armnginx.DeploymentsClientBeginCreateOrUpdateOptions{Body: 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.Deployment = armnginx.Deployment{ - // Name: to.Ptr("myDeployment"), - // Type: to.Ptr("nginx.nginxplus/deployments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment"), - // Location: to.Ptr("westus"), - // Properties: &armnginx.DeploymentProperties{ - // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ - // UpgradeChannel: to.Ptr("stable"), - // }, - // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), - // IPAddress: to.Ptr("1.1.1.1"), - // NetworkProfile: &armnginx.NetworkProfile{ - // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ - // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ - // { - // PrivateIPAddress: to.Ptr("1.1.1.1"), - // PrivateIPAllocationMethod: to.Ptr(armnginx.NginxPrivateIPAllocationMethodStatic), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }}, - // PublicIPAddresses: []*armnginx.PublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIPAddress"), - // }}, - // }, - // NetworkInterfaceConfiguration: &armnginx.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ - // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ - // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), - // }, - // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ - // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.21"), - // }, - // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.22"), - // }, - // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ - // WafEngineVersion: to.Ptr("10.624.0"), - // WafNginxVersion: to.Ptr("4.815.0"), - // }, - // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.23"), - // }, - // }, - // }, - // NginxVersion: to.Ptr("nginx-1.19.6"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // ScalingProperties: &armnginx.DeploymentScalingProperties{ - // Capacity: to.Ptr[int32](10), - // }, - // }, - // Tags: map[string]*string{ - // "Environment": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Update.json -func ExampleDeploymentsClient_BeginUpdate_deploymentsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeploymentsClient().BeginUpdate(ctx, "myResourceGroup", "myDeployment", &armnginx.DeploymentsClientBeginUpdateOptions{Body: 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.Deployment = armnginx.Deployment{ - // Name: to.Ptr("myDeployment"), - // Type: to.Ptr("nginx.nginxplus/deployments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment"), - // Location: to.Ptr("westus"), - // Properties: &armnginx.DeploymentProperties{ - // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ - // UpgradeChannel: to.Ptr("stable"), - // }, - // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), - // IPAddress: to.Ptr("1.1.1.1"), - // NetworkProfile: &armnginx.NetworkProfile{ - // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ - // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ - // { - // PrivateIPAddress: to.Ptr("1.1.1.1"), - // PrivateIPAllocationMethod: to.Ptr(armnginx.NginxPrivateIPAllocationMethodStatic), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }}, - // PublicIPAddresses: []*armnginx.PublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIPAddress"), - // }}, - // }, - // NetworkInterfaceConfiguration: &armnginx.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ - // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ - // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), - // }, - // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ - // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.21"), - // }, - // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.22"), - // }, - // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ - // WafEngineVersion: to.Ptr("10.624.0"), - // WafNginxVersion: to.Ptr("4.815.0"), - // }, - // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.23"), - // }, - // }, - // }, - // NginxVersion: to.Ptr("nginx-1.19.6"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // ScalingProperties: &armnginx.DeploymentScalingProperties{ - // Capacity: to.Ptr[int32](10), - // }, - // UserProfile: &armnginx.DeploymentUserProfile{ - // PreferredEmail: to.Ptr("example@example.email"), - // }, - // }, - // Tags: map[string]*string{ - // "Environment": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_UpdateSubnet.json -func ExampleDeploymentsClient_BeginUpdate_deploymentsUpdateSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeploymentsClient().BeginUpdate(ctx, "myResourceGroup", "myDeployment", &armnginx.DeploymentsClientBeginUpdateOptions{Body: 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.Deployment = armnginx.Deployment{ - // Name: to.Ptr("myDeployment"), - // Type: to.Ptr("nginx.nginxplus/deployments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment"), - // Location: to.Ptr("westus"), - // Properties: &armnginx.DeploymentProperties{ - // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ - // UpgradeChannel: to.Ptr("stable"), - // }, - // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), - // IPAddress: to.Ptr("1.1.1.1"), - // NetworkProfile: &armnginx.NetworkProfile{ - // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ - // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ - // }, - // PublicIPAddresses: []*armnginx.PublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIPAddress"), - // }}, - // }, - // NetworkInterfaceConfiguration: &armnginx.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet2/subnets/mySubnet"), - // }, - // }, - // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ - // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ - // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), - // }, - // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ - // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.21"), - // }, - // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.22"), - // }, - // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ - // WafEngineVersion: to.Ptr("10.624.0"), - // WafNginxVersion: to.Ptr("4.815.0"), - // }, - // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.23"), - // }, - // }, - // }, - // NginxVersion: to.Ptr("nginx-1.19.6"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // ScalingProperties: &armnginx.DeploymentScalingProperties{ - // Capacity: to.Ptr[int32](10), - // }, - // UserProfile: &armnginx.DeploymentUserProfile{ - // PreferredEmail: to.Ptr("example@example.email"), - // }, - // }, - // Tags: map[string]*string{ - // "Environment": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Delete.json -func ExampleDeploymentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeploymentsClient().BeginDelete(ctx, "myResourceGroup", "myDeployment", 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/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_List.json -func ExampleDeploymentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeploymentsClient().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.DeploymentListResponse = armnginx.DeploymentListResponse{ - // Value: []*armnginx.Deployment{ - // { - // Name: to.Ptr("myDeployment"), - // Type: to.Ptr("nginx.nginxplus/deployments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment"), - // Location: to.Ptr("westus"), - // Properties: &armnginx.DeploymentProperties{ - // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ - // UpgradeChannel: to.Ptr("stable"), - // }, - // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), - // IPAddress: to.Ptr("1.1.1.1"), - // NetworkProfile: &armnginx.NetworkProfile{ - // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ - // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ - // { - // PrivateIPAddress: to.Ptr("1.1.1.1"), - // PrivateIPAllocationMethod: to.Ptr(armnginx.NginxPrivateIPAllocationMethodStatic), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }}, - // PublicIPAddresses: []*armnginx.PublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIPAddress"), - // }}, - // }, - // NetworkInterfaceConfiguration: &armnginx.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ - // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ - // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), - // }, - // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ - // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.21"), - // }, - // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.22"), - // }, - // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ - // WafEngineVersion: to.Ptr("10.624.0"), - // WafNginxVersion: to.Ptr("4.815.0"), - // }, - // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.23"), - // }, - // }, - // }, - // NginxVersion: to.Ptr("nginx-1.19.6"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // ScalingProperties: &armnginx.DeploymentScalingProperties{ - // Capacity: to.Ptr[int32](10), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_ListByResourceGroup.json -func ExampleDeploymentsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnginx.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeploymentsClient().NewListByResourceGroupPager("myResourceGroup", 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.DeploymentListResponse = armnginx.DeploymentListResponse{ - // Value: []*armnginx.Deployment{ - // { - // Name: to.Ptr("myDeployment"), - // Type: to.Ptr("nginx.nginxplus/deployments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment"), - // Location: to.Ptr("westus"), - // Properties: &armnginx.DeploymentProperties{ - // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ - // UpgradeChannel: to.Ptr("stable"), - // }, - // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), - // IPAddress: to.Ptr("1.1.1.1"), - // NetworkProfile: &armnginx.NetworkProfile{ - // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ - // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ - // { - // PrivateIPAddress: to.Ptr("1.1.1.1"), - // PrivateIPAllocationMethod: to.Ptr(armnginx.NginxPrivateIPAllocationMethodStatic), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }}, - // PublicIPAddresses: []*armnginx.PublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIPAddress"), - // }}, - // }, - // NetworkInterfaceConfiguration: &armnginx.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ - // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ - // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), - // }, - // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ - // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.21"), - // }, - // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.22"), - // }, - // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ - // WafEngineVersion: to.Ptr("10.624.0"), - // WafNginxVersion: to.Ptr("4.815.0"), - // }, - // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ - // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), - // Version: to.Ptr("2024.02.23"), - // }, - // }, - // }, - // NginxVersion: to.Ptr("nginx-1.19.6"), - // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), - // ScalingProperties: &armnginx.DeploymentScalingProperties{ - // Capacity: to.Ptr[int32](10), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/nginx/armnginx/fake/apikeys_server.go b/sdk/resourcemanager/nginx/armnginx/fake/apikeys_server.go index 275abff146ce..2e2b089da3be 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/apikeys_server.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/apikeys_server.go @@ -1,6 +1,3 @@ -//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. @@ -19,7 +16,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" "net/http" "net/url" - "reflect" "regexp" ) @@ -27,7 +23,7 @@ import ( type APIKeysServer struct { // CreateOrUpdate is the fake for method APIKeysClient.CreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *armnginx.APIKeysClientCreateOrUpdateOptions) (resp azfake.Responder[armnginx.APIKeysClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + CreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, body armnginx.DeploymentAPIKeyResponse, options *armnginx.APIKeysClientCreateOrUpdateOptions) (resp azfake.Responder[armnginx.APIKeysClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method APIKeysClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent @@ -67,27 +63,46 @@ func (a *APIKeysServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "APIKeysClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "APIKeysClient.Delete": - resp, err = a.dispatchDelete(req) - case "APIKeysClient.Get": - resp, err = a.dispatchGet(req) - case "APIKeysClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *APIKeysServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if apiKeysServerTransportInterceptor != nil { + res.resp, res.err, intercepted = apiKeysServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "APIKeysClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "APIKeysClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "APIKeysClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "APIKeysClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *APIKeysServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -100,7 +115,7 @@ func (a *APIKeysServerTransport) dispatchCreateOrUpdate(req *http.Request) (*htt if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armnginx.DeploymentAPIKeyRequest](req) + body, err := server.UnmarshalRequestAsJSON[armnginx.DeploymentAPIKeyResponse](req) if err != nil { return nil, err } @@ -116,13 +131,7 @@ func (a *APIKeysServerTransport) dispatchCreateOrUpdate(req *http.Request) (*htt if err != nil { return nil, err } - var options *armnginx.APIKeysClientCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armnginx.APIKeysClientCreateOrUpdateOptions{ - Body: &body, - } - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, apiKeyNameParam, options) + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, apiKeyNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -251,3 +260,9 @@ func (a *APIKeysServerTransport) dispatchNewListPager(req *http.Request) (*http. } return resp, nil } + +// set this to conditionally intercept incoming requests to APIKeysServerTransport +var apiKeysServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/nginx/armnginx/fake/certificates_server.go b/sdk/resourcemanager/nginx/armnginx/fake/certificates_server.go index e11feb3c142a..7ecc4aa67cd9 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/certificates_server.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/certificates_server.go @@ -1,6 +1,3 @@ -//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. @@ -19,7 +16,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" "net/http" "net/url" - "reflect" "regexp" ) @@ -27,7 +23,7 @@ import ( type CertificatesServer struct { // BeginCreateOrUpdate is the fake for method CertificatesClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *armnginx.CertificatesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnginx.CertificatesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, body armnginx.Certificate, options *armnginx.CertificatesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnginx.CertificatesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CertificatesClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent @@ -71,27 +67,46 @@ func (c *CertificatesServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CertificatesClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CertificatesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CertificatesClient.Get": - resp, err = c.dispatchGet(req) - case "CertificatesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CertificatesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if certificatesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = certificatesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CertificatesClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CertificatesClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CertificatesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CertificatesClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CertificatesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -122,13 +137,7 @@ func (c *CertificatesServerTransport) dispatchBeginCreateOrUpdate(req *http.Requ if err != nil { return nil, err } - var options *armnginx.CertificatesClientBeginCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armnginx.CertificatesClientBeginCreateOrUpdateOptions{ - Body: &body, - } - } - respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, certificateNameParam, options) + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, certificateNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -277,3 +286,9 @@ func (c *CertificatesServerTransport) dispatchNewListPager(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to CertificatesServerTransport +var certificatesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go b/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go index 3b1049a4ae32..369ae7ac1207 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go @@ -1,6 +1,3 @@ -//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. @@ -31,7 +28,7 @@ type ConfigurationsServer struct { // BeginCreateOrUpdate is the fake for method ConfigurationsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *armnginx.ConfigurationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnginx.ConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, body armnginx.ConfigurationResponse, options *armnginx.ConfigurationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnginx.ConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ConfigurationsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent @@ -75,29 +72,48 @@ func (c *ConfigurationsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "ConfigurationsClient.Analysis": - resp, err = c.dispatchAnalysis(req) - case "ConfigurationsClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "ConfigurationsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "ConfigurationsClient.Get": - resp, err = c.dispatchGet(req) - case "ConfigurationsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ConfigurationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if configurationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = configurationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ConfigurationsClient.Analysis": + res.resp, res.err = c.dispatchAnalysis(req) + case "ConfigurationsClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "ConfigurationsClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "ConfigurationsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ConfigurationsClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ConfigurationsServerTransport) dispatchAnalysis(req *http.Request) (*http.Response, error) { @@ -159,7 +175,7 @@ func (c *ConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Re if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armnginx.ConfigurationRequest](req) + body, err := server.UnmarshalRequestAsJSON[armnginx.ConfigurationResponse](req) if err != nil { return nil, err } @@ -175,13 +191,7 @@ func (c *ConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Re if err != nil { return nil, err } - var options *armnginx.ConfigurationsClientBeginCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armnginx.ConfigurationsClientBeginCreateOrUpdateOptions{ - Body: &body, - } - } - respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, configurationNameParam, options) + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, configurationNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -330,3 +340,9 @@ func (c *ConfigurationsServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to ConfigurationsServerTransport +var configurationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/nginx/armnginx/fake/deployments_server.go b/sdk/resourcemanager/nginx/armnginx/fake/deployments_server.go index fcd80b00ae5e..8f3dd59aeb7b 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/deployments_server.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/deployments_server.go @@ -1,6 +1,3 @@ -//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. @@ -19,7 +16,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" "net/http" "net/url" - "reflect" "regexp" ) @@ -27,7 +23,7 @@ import ( type DeploymentsServer struct { // BeginCreateOrUpdate is the fake for method DeploymentsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, options *armnginx.DeploymentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnginx.DeploymentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, body armnginx.Deployment, options *armnginx.DeploymentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnginx.DeploymentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DeploymentsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent @@ -47,7 +43,7 @@ type DeploymentsServer struct { // BeginUpdate is the fake for method DeploymentsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, options *armnginx.DeploymentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armnginx.DeploymentsClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, body armnginx.DeploymentUpdateParameters, options *armnginx.DeploymentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armnginx.DeploymentsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewDeploymentsServerTransport creates a new instance of DeploymentsServerTransport with the provided implementation. @@ -83,31 +79,50 @@ func (d *DeploymentsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DeploymentsClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DeploymentsClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DeploymentsClient.Get": - resp, err = d.dispatchGet(req) - case "DeploymentsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - case "DeploymentsClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - case "DeploymentsClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DeploymentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if deploymentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deploymentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeploymentsClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DeploymentsClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DeploymentsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DeploymentsClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + case "DeploymentsClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + case "DeploymentsClient.BeginUpdate": + res.resp, res.err = d.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -134,13 +149,7 @@ func (d *DeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Reque if err != nil { return nil, err } - var options *armnginx.DeploymentsClientBeginCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armnginx.DeploymentsClientBeginCreateOrUpdateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, options) + respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -335,13 +344,7 @@ func (d *DeploymentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht if err != nil { return nil, err } - var options *armnginx.DeploymentsClientBeginUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armnginx.DeploymentsClientBeginUpdateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, options) + respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -364,3 +367,9 @@ func (d *DeploymentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht return resp, nil } + +// set this to conditionally intercept incoming requests to DeploymentsServerTransport +var deploymentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/nginx/armnginx/fake/internal.go b/sdk/resourcemanager/nginx/armnginx/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/internal.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/internal.go @@ -1,6 +1,3 @@ -//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. @@ -14,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/nginx/armnginx/fake/operations_server.go b/sdk/resourcemanager/nginx/armnginx/fake/operations_server.go index 036ba95be4f4..7077a9615b0b 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/operations_server.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/operations_server.go @@ -1,6 +1,3 @@ -//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. @@ -51,21 +48,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -94,3 +110,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/nginx/armnginx/fake/server_factory.go b/sdk/resourcemanager/nginx/armnginx/fake/server_factory.go index 25e353dcbcc7..a8f1aa500f05 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/server_factory.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/server_factory.go @@ -1,6 +1,3 @@ -//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. @@ -19,11 +16,20 @@ import ( // ServerFactory is a fake server for instances of the armnginx.ClientFactory type. type ServerFactory struct { - APIKeysServer APIKeysServer - CertificatesServer CertificatesServer + // APIKeysServer contains the fakes for client APIKeysClient + APIKeysServer APIKeysServer + + // CertificatesServer contains the fakes for client CertificatesClient + CertificatesServer CertificatesServer + + // ConfigurationsServer contains the fakes for client ConfigurationsClient ConfigurationsServer ConfigurationsServer - DeploymentsServer DeploymentsServer - OperationsServer OperationsServer + + // DeploymentsServer contains the fakes for client DeploymentsClient + DeploymentsServer DeploymentsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/nginx/armnginx/fake/time_rfc3339.go b/sdk/resourcemanager/nginx/armnginx/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/nginx/armnginx/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/nginx/armnginx/go.mod b/sdk/resourcemanager/nginx/armnginx/go.mod index e685007452b5..06973a5a6c58 100644 --- a/sdk/resourcemanager/nginx/armnginx/go.mod +++ b/sdk/resourcemanager/nginx/armnginx/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3 go 1.23.0 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/nginx/armnginx/go.sum b/sdk/resourcemanager/nginx/armnginx/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/nginx/armnginx/go.sum +++ b/sdk/resourcemanager/nginx/armnginx/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/nginx/armnginx/models.go b/sdk/resourcemanager/nginx/armnginx/models.go index 056a6ade3d80..4b203cdc4eb7 100644 --- a/sdk/resourcemanager/nginx/armnginx/models.go +++ b/sdk/resourcemanager/nginx/armnginx/models.go @@ -1,6 +1,3 @@ -//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. @@ -67,20 +64,27 @@ type AutoUpgradeProfile struct { UpgradeChannel *string } +// AzureResourceManagerResourceSKUProperty - The SKU (Stock Keeping Unit) assigned to this resource. +type AzureResourceManagerResourceSKUProperty struct { + // The SKU (Stock Keeping Unit) assigned to this resource. + SKU *SKU +} + +// Certificate - Concrete proxy resource types can be created by aliasing this type using a specific property type. type Certificate struct { Location *string Properties *CertificateProperties - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -89,9 +93,13 @@ type CertificateErrorResponseBody struct { Message *string } +// CertificateListResponse - Paged collection of NginxCertificate items type CertificateListResponse struct { + // REQUIRED; The NginxCertificate items on this page + Value []*Certificate + + // The link to the next page of items NextLink *string - Value []*Certificate } type CertificateProperties struct { @@ -120,11 +128,11 @@ type ConfigurationFile struct { // ConfigurationListResponse - Response of a list operation. type ConfigurationListResponse struct { - // Link to the next set of results, if any. - NextLink *string - - // Results of a list operation. + // REQUIRED; The NginxConfigurationResponse items on this page Value []*ConfigurationResponse + + // The link to the next page of items + NextLink *string } type ConfigurationPackage struct { @@ -152,45 +160,20 @@ type ConfigurationProtectedFileResponse struct { VirtualPath *string } -type ConfigurationRequest struct { - Properties *ConfigurationRequestProperties - - // READ-ONLY - ID *string - - // READ-ONLY - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY - Type *string -} - -type ConfigurationRequestProperties struct { - Files []*ConfigurationFile - Package *ConfigurationPackage - ProtectedFiles []*ConfigurationProtectedFileRequest - RootFile *string - - // READ-ONLY - ProvisioningState *ProvisioningState -} - +// ConfigurationResponse - Concrete proxy resource types can be created by aliasing this type using a specific property type. type ConfigurationResponse struct { Properties *ConfigurationResponseProperties - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -204,65 +187,56 @@ type ConfigurationResponseProperties struct { ProvisioningState *ProvisioningState } +// Deployment - Concrete tracked resource types can be created by aliasing this type using a specific property type. type Deployment struct { - Identity *IdentityProperties + // REQUIRED; The geo-location where the resource lives Location *string + Identity *IdentityProperties Properties *DeploymentProperties - SKU *ResourceSKU - // Dictionary of + // The SKU (Stock Keeping Unit) assigned to this resource. + SKU *AzureResourceManagerResourceSKUProperty + + // Resource tags. Tags map[string]*string - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// DeploymentAPIKeyListResponse - Paged collection of NginxDeploymentApiKeyResponse items type DeploymentAPIKeyListResponse struct { - NextLink *string - Value []*DeploymentAPIKeyResponse -} - -type DeploymentAPIKeyRequest struct { - Properties *DeploymentAPIKeyRequestProperties - - // READ-ONLY - ID *string - - // READ-ONLY - Name *string - - // READ-ONLY - Type *string -} - -type DeploymentAPIKeyRequestProperties struct { - // The time after which this Dataplane API Key is no longer valid. - EndDateTime *time.Time + // REQUIRED; The NginxDeploymentApiKeyResponse items on this page + Value []*DeploymentAPIKeyResponse - // Secret text to be used as a Dataplane API Key. This is a write only property that can never be read back, but the first - // three characters will be returned in the 'hint' property. - SecretText *string + // The link to the next page of items + NextLink *string } +// DeploymentAPIKeyResponse - Concrete proxy resource types can be created by aliasing this type using a specific property +// type. type DeploymentAPIKeyResponse struct { Properties *DeploymentAPIKeyResponseProperties - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY + // READ-ONLY; The name of the resource Name *string - // READ-ONLY + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -274,9 +248,13 @@ type DeploymentAPIKeyResponseProperties struct { Hint *string } +// DeploymentListResponse - Paged collection of NginxDeployment items type DeploymentListResponse struct { + // REQUIRED; The NginxDeployment items on this page + Value []*Deployment + + // The link to the next page of items NextLink *string - Value []*Deployment } type DeploymentProperties struct { @@ -333,7 +311,9 @@ type DeploymentUpdateParameters struct { Identity *IdentityProperties Location *string Properties *DeploymentUpdateProperties - SKU *ResourceSKU + + // The SKU (Stock Keeping Unit) assigned to this resource. + SKU *AzureResourceManagerResourceSKUProperty // Dictionary of Tags map[string]*string @@ -428,40 +408,53 @@ type NetworkProfile struct { NetworkInterfaceConfiguration *NetworkInterfaceConfiguration } -// OperationDisplay - The object that represents the operation. +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. type OperationDisplay struct { - // Description of the operation, e.g., 'Write deployments'. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // Operation type, e.g., read, write, delete, etc. + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". Operation *string - // Service provider: Nginx.NginxPlus + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // Type on which the operation is performed, e.g., 'deployments'. + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } -// OperationListResult - Result of GET request to list Nginx.NginxPlus operations. +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. type OperationListResult struct { - // URL to get the next set of operation list results if there are any. + // READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string - // List of operations supported by the Nginx.NginxPlus provider. - Value []*OperationResult -} - -// OperationResult - A Nginx.NginxPlus REST API operation. -type OperationResult struct { - // The object that represents the operation. - Display *OperationDisplay - - // Indicates whether the operation is a data action - IsDataAction *bool - - // Operation name: {provider}/{resource}/{operation} - Name *string + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation } type PrivateIPAddress struct { @@ -474,9 +467,24 @@ type PublicIPAddress struct { ID *string } -type ResourceSKU struct { - // REQUIRED; Name of the SKU. +// SKU - The resource model definition representing SKU +type SKU struct { + // REQUIRED; The name of the SKU. E.g. P3. It is typically a letter+number code Name *string + + // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the + // resource this may be omitted. + Capacity *int32 + + // If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string + + // The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string + + // This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required + // on a PUT. + Tier *SKUTier } // ScaleProfile - The autoscale profile. diff --git a/sdk/resourcemanager/nginx/armnginx/models_serde.go b/sdk/resourcemanager/nginx/armnginx/models_serde.go index fcc20547e394..73594f275671 100644 --- a/sdk/resourcemanager/nginx/armnginx/models_serde.go +++ b/sdk/resourcemanager/nginx/armnginx/models_serde.go @@ -1,6 +1,3 @@ -//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. @@ -221,6 +218,33 @@ func (a *AutoUpgradeProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureResourceManagerResourceSKUProperty. +func (a AzureResourceManagerResourceSKUProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sku", a.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceManagerResourceSKUProperty. +func (a *AzureResourceManagerResourceSKUProperty) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sku": + err = unpopulate(val, "SKU", &a.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Certificate. func (c Certificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -544,92 +568,6 @@ func (c *ConfigurationProtectedFileResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationRequest. -func (c ConfigurationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationRequest. -func (c *ConfigurationRequest) 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 "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - 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 ConfigurationRequestProperties. -func (c ConfigurationRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "files", c.Files) - populate(objectMap, "package", c.Package) - populate(objectMap, "protectedFiles", c.ProtectedFiles) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "rootFile", c.RootFile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationRequestProperties. -func (c *ConfigurationRequestProperties) 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 "files": - err = unpopulate(val, "Files", &c.Files) - delete(rawMsg, key) - case "package": - err = unpopulate(val, "Package", &c.Package) - delete(rawMsg, key) - case "protectedFiles": - err = unpopulate(val, "ProtectedFiles", &c.ProtectedFiles) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "rootFile": - err = unpopulate(val, "RootFile", &c.RootFile) - 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 ConfigurationResponse. func (c ConfigurationResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -806,82 +744,13 @@ func (d *DeploymentAPIKeyListResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeploymentAPIKeyRequest. -func (d DeploymentAPIKeyRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentAPIKeyRequest. -func (d *DeploymentAPIKeyRequest) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DeploymentAPIKeyRequestProperties. -func (d DeploymentAPIKeyRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endDateTime", d.EndDateTime) - populate(objectMap, "secretText", d.SecretText) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentAPIKeyRequestProperties. -func (d *DeploymentAPIKeyRequestProperties) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endDateTime": - err = unpopulateDateTimeRFC3339(val, "EndDateTime", &d.EndDateTime) - delete(rawMsg, key) - case "secretText": - err = unpopulate(val, "SecretText", &d.SecretText) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type DeploymentAPIKeyResponse. func (d DeploymentAPIKeyResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -904,6 +773,9 @@ func (d *DeploymentAPIKeyResponse) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -1495,6 +1367,49 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OperationDisplay. func (o OperationDisplay) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1565,41 +1480,6 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationResult. -func (o OperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResult. -func (o *OperationResult) 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", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type PrivateIPAddress. func (p PrivateIPAddress) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1662,28 +1542,44 @@ func (p *PublicIPAddress) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceSKU. -func (r ResourceSKU) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", r.Name) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "family", s.Family) + populate(objectMap, "name", s.Name) + populate(objectMap, "size", s.Size) + populate(objectMap, "tier", s.Tier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU. -func (r *ResourceSKU) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &s.Family) + delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &s.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil diff --git a/sdk/resourcemanager/nginx/armnginx/operations_client.go b/sdk/resourcemanager/nginx/armnginx/operations_client.go index 12421fb6b296..c7626f85d964 100644 --- a/sdk/resourcemanager/nginx/armnginx/operations_client.go +++ b/sdk/resourcemanager/nginx/armnginx/operations_client.go @@ -1,6 +1,3 @@ -//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. @@ -37,7 +34,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. +// NewListPager - List the operations for the provider // // Generated from API version 2024-11-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. @@ -65,7 +62,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Nginx.NginxPlus/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/nginx/armnginx/operations_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/operations_client_example_test.go deleted file mode 100644 index a22fce17c805..000000000000 --- a/sdk/resourcemanager/nginx/armnginx/operations_client_example_test.go +++ /dev/null @@ -1,55 +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 armnginx_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Operations_List.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 := armnginx.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 = armnginx.OperationListResult{ - // Value: []*armnginx.OperationResult{ - // { - // Name: to.Ptr("Nginx.NginxPlus/nginxDeployments/write"), - // Display: &armnginx.OperationDisplay{ - // Description: to.Ptr("Write deployments resource"), - // Operation: to.Ptr("write"), - // Provider: to.Ptr("Nginx.NginxPlus"), - // Resource: to.Ptr("deployments"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/nginx/armnginx/options.go b/sdk/resourcemanager/nginx/armnginx/options.go index 1050cf1dd817..4e14919f09d7 100644 --- a/sdk/resourcemanager/nginx/armnginx/options.go +++ b/sdk/resourcemanager/nginx/armnginx/options.go @@ -1,6 +1,3 @@ -//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. @@ -10,8 +7,7 @@ package armnginx // APIKeysClientCreateOrUpdateOptions contains the optional parameters for the APIKeysClient.CreateOrUpdate method. type APIKeysClientCreateOrUpdateOptions struct { - // The API Key object containing fields (e.g. secret text, expiration date) to upsert the key. - Body *DeploymentAPIKeyRequest + // placeholder for future optional parameters } // APIKeysClientDeleteOptions contains the optional parameters for the APIKeysClient.Delete method. @@ -32,16 +28,13 @@ type APIKeysClientListOptions struct { // CertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.BeginCreateOrUpdate // method. type CertificatesClientBeginCreateOrUpdateOptions struct { - // The certificate - Body *Certificate - - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CertificatesClientBeginDeleteOptions contains the optional parameters for the CertificatesClient.BeginDelete method. type CertificatesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -64,16 +57,13 @@ type ConfigurationsClientAnalysisOptions struct { // ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate // method. type ConfigurationsClientBeginCreateOrUpdateOptions struct { - // The NGINX configuration - Body *ConfigurationRequest - - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ConfigurationsClientBeginDeleteOptions contains the optional parameters for the ConfigurationsClient.BeginDelete method. type ConfigurationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -90,23 +80,19 @@ type ConfigurationsClientListOptions struct { // DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate // method. type DeploymentsClientBeginCreateOrUpdateOptions struct { - Body *Deployment - - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. type DeploymentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DeploymentsClientBeginUpdateOptions contains the optional parameters for the DeploymentsClient.BeginUpdate method. type DeploymentsClientBeginUpdateOptions struct { - Body *DeploymentUpdateParameters - - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/nginx/armnginx/responses.go b/sdk/resourcemanager/nginx/armnginx/responses.go index 2b411cd67eb2..08bf84a0b155 100644 --- a/sdk/resourcemanager/nginx/armnginx/responses.go +++ b/sdk/resourcemanager/nginx/armnginx/responses.go @@ -1,6 +1,3 @@ -//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. @@ -10,6 +7,7 @@ package armnginx // APIKeysClientCreateOrUpdateResponse contains the response from method APIKeysClient.CreateOrUpdate. type APIKeysClientCreateOrUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. DeploymentAPIKeyResponse } @@ -20,16 +18,19 @@ type APIKeysClientDeleteResponse struct { // APIKeysClientGetResponse contains the response from method APIKeysClient.Get. type APIKeysClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. DeploymentAPIKeyResponse } // APIKeysClientListResponse contains the response from method APIKeysClient.NewListPager. type APIKeysClientListResponse struct { + // Paged collection of NginxDeploymentApiKeyResponse items DeploymentAPIKeyListResponse } // CertificatesClientCreateOrUpdateResponse contains the response from method CertificatesClient.BeginCreateOrUpdate. type CertificatesClientCreateOrUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. Certificate } @@ -40,11 +41,13 @@ type CertificatesClientDeleteResponse struct { // CertificatesClientGetResponse contains the response from method CertificatesClient.Get. type CertificatesClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. Certificate } // CertificatesClientListResponse contains the response from method CertificatesClient.NewListPager. type CertificatesClientListResponse struct { + // Paged collection of NginxCertificate items CertificateListResponse } @@ -56,6 +59,7 @@ type ConfigurationsClientAnalysisResponse struct { // ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.BeginCreateOrUpdate. type ConfigurationsClientCreateOrUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. ConfigurationResponse } @@ -66,6 +70,7 @@ type ConfigurationsClientDeleteResponse struct { // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. ConfigurationResponse } @@ -77,6 +82,7 @@ type ConfigurationsClientListResponse struct { // DeploymentsClientCreateOrUpdateResponse contains the response from method DeploymentsClient.BeginCreateOrUpdate. type DeploymentsClientCreateOrUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. Deployment } @@ -87,26 +93,30 @@ type DeploymentsClientDeleteResponse struct { // DeploymentsClientGetResponse contains the response from method DeploymentsClient.Get. type DeploymentsClientGetResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. Deployment } // DeploymentsClientListByResourceGroupResponse contains the response from method DeploymentsClient.NewListByResourceGroupPager. type DeploymentsClientListByResourceGroupResponse struct { + // Paged collection of NginxDeployment items DeploymentListResponse } // DeploymentsClientListResponse contains the response from method DeploymentsClient.NewListPager. type DeploymentsClientListResponse struct { + // Paged collection of NginxDeployment items DeploymentListResponse } // DeploymentsClientUpdateResponse contains the response from method DeploymentsClient.BeginUpdate. type DeploymentsClientUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. Deployment } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // Result of GET request to list Nginx.NginxPlus operations. + // 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 } diff --git a/sdk/resourcemanager/nginx/armnginx/time_rfc3339.go b/sdk/resourcemanager/nginx/armnginx/time_rfc3339.go index a1bd429f7483..4cc05ee679c4 100644 --- a/sdk/resourcemanager/nginx/armnginx/time_rfc3339.go +++ b/sdk/resourcemanager/nginx/armnginx/time_rfc3339.go @@ -1,6 +1,3 @@ -//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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string