From 69352569b752d27cfb81bf25a1f7b86239df4d7c Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 20 Mar 2024 01:26:19 -0400 Subject: [PATCH] [Release] sdk/resourcemanager/nginx/armnginx/3.1.0-beta.1 (#22507) * [Release] sdk/resourcemanager/nginx/armnginx/4.0.0-beta.1 generation from spec commit: e4009d2f8d3bf0271757e522c7d1c1997e193d44 * add removeUnreferencedTypes flag * fix --------- Co-authored-by: ReleaseHelper Co-authored-by: Alancere <804873052@qq.com> --- .../nginx/armnginx/CHANGELOG.md | 20 + sdk/resourcemanager/nginx/armnginx/README.md | 2 +- .../nginx/armnginx/autorest.md | 8 +- sdk/resourcemanager/nginx/armnginx/build.go | 2 +- .../nginx/armnginx/certificates_client.go | 20 +- .../certificates_client_example_test.go | 25 +- .../nginx/armnginx/client_factory.go | 32 +- .../nginx/armnginx/configurations_client.go | 95 ++++- .../configurations_client_example_test.go | 43 +- .../nginx/armnginx/constants.go | 2 +- .../nginx/armnginx/deployments_client.go | 30 +- .../deployments_client_example_test.go | 110 ++++- .../armnginx/fake/configurations_server.go | 53 +++ .../nginx/armnginx/fake/time_rfc3339.go | 42 +- sdk/resourcemanager/nginx/armnginx/go.mod | 10 +- sdk/resourcemanager/nginx/armnginx/go.sum | 22 +- sdk/resourcemanager/nginx/armnginx/models.go | 128 +++++- .../nginx/armnginx/models_serde.go | 394 +++++++++++++++--- .../nginx/armnginx/operations_client.go | 6 +- .../operations_client_example_test.go | 2 +- sdk/resourcemanager/nginx/armnginx/options.go | 6 + .../{response_types.go => responses.go} | 6 + .../nginx/armnginx/time_rfc3339.go | 42 +- 23 files changed, 921 insertions(+), 179 deletions(-) rename sdk/resourcemanager/nginx/armnginx/{response_types.go => responses.go} (91%) diff --git a/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md b/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md index d9ef9d97a483..37611e369554 100644 --- a/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md +++ b/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md @@ -1,5 +1,25 @@ # Release History +## 3.1.0-beta.1 (2024-03-22) +### Features Added + +- New function `*ConfigurationsClient.Analysis(context.Context, string, string, string, *ConfigurationsClientAnalysisOptions) (ConfigurationsClientAnalysisResponse, error)` +- New struct `AnalysisCreate` +- New struct `AnalysisCreateConfig` +- New struct `AnalysisDiagnostic` +- New struct `AnalysisResult` +- New struct `AnalysisResultData` +- New struct `AutoUpgradeProfile` +- New struct `CertificateErrorResponseBody` +- New struct `DeploymentScalingPropertiesAutoScaleSettings` +- New struct `ScaleProfile` +- New struct `ScaleProfileCapacity` +- New field `CertificateError`, `KeyVaultSecretCreated`, `KeyVaultSecretVersion`, `SHA1Thumbprint` in struct `CertificateProperties` +- New field `AutoUpgradeProfile` in struct `DeploymentProperties` +- New field `AutoScaleSettings` in struct `DeploymentScalingProperties` +- New field `AutoUpgradeProfile` in struct `DeploymentUpdateProperties` + + ## 3.0.0 (2023-11-24) ### Breaking Changes diff --git a/sdk/resourcemanager/nginx/armnginx/README.md b/sdk/resourcemanager/nginx/armnginx/README.md index dbf52eacefe4..0259ec927af9 100644 --- a/sdk/resourcemanager/nginx/armnginx/README.md +++ b/sdk/resourcemanager/nginx/armnginx/README.md @@ -57,7 +57,7 @@ clientFactory, err := armnginx.NewClientFactory(, cred, &option A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewDeploymentsClient() +client := clientFactory.NewCertificatesClient() ``` ## Fakes diff --git a/sdk/resourcemanager/nginx/armnginx/autorest.md b/sdk/resourcemanager/nginx/armnginx/autorest.md index 721ae341bdef..d2af4678a73c 100644 --- a/sdk/resourcemanager/nginx/armnginx/autorest.md +++ b/sdk/resourcemanager/nginx/armnginx/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 3.0.0 -tag: package-2023-04-01 +module-version: 3.1.0-beta.1 +tag: package-2024-01-01-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/nginx/armnginx/build.go b/sdk/resourcemanager/nginx/armnginx/build.go index 4ca53a651f4d..4d34085b87bc 100644 --- a/sdk/resourcemanager/nginx/armnginx/build.go +++ b/sdk/resourcemanager/nginx/armnginx/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/nginx/armnginx +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/nginx/armnginx package armnginx diff --git a/sdk/resourcemanager/nginx/armnginx/certificates_client.go b/sdk/resourcemanager/nginx/armnginx/certificates_client.go index d523e4ed480e..b657713d7d17 100644 --- a/sdk/resourcemanager/nginx/armnginx/certificates_client.go +++ b/sdk/resourcemanager/nginx/armnginx/certificates_client.go @@ -46,7 +46,7 @@ func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateOrUpdate - Create or update the NGINX certificates for given NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - certificateName - The name of certificate @@ -73,7 +73,7 @@ func (client *CertificatesClient) BeginCreateOrUpdate(ctx context.Context, resou // CreateOrUpdate - Create or update the NGINX certificates for given NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview func (client *CertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *CertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CertificatesClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -134,7 +134,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex // BeginDelete - Deletes a certificate from the NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - certificateName - The name of certificate @@ -160,7 +160,7 @@ func (client *CertificatesClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes a certificate from the NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview func (client *CertificatesClient) deleteOperation(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *CertificatesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CertificatesClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a certificate of given NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - certificateName - The name of certificate @@ -266,7 +266,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *CertificatesClient) getHandleResponse(resp *http.Response) (Certif // NewListPager - List all certificates of given NGINX deployment // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - options - CertificatesClientListOptions contains the optional parameters for the CertificatesClient.NewListPager method. @@ -330,7 +330,7 @@ func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/nginx/armnginx/certificates_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/certificates_client_example_test.go index 3a88d6d373b9..847341257d01 100644 --- a/sdk/resourcemanager/nginx/armnginx/certificates_client_example_test.go +++ b/sdk/resourcemanager/nginx/armnginx/certificates_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_Get.json func ExampleCertificatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -40,15 +40,22 @@ func ExampleCertificatesClient_Get() { // 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/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_CreateOrUpdate.json func ExampleCertificatesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -83,7 +90,7 @@ func ExampleCertificatesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_Delete.json func ExampleCertificatesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -104,7 +111,7 @@ func ExampleCertificatesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_List.json func ExampleCertificatesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -133,10 +140,17 @@ func ExampleCertificatesClient_NewListPager() { // 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"), // }, // }, // { @@ -145,9 +159,12 @@ func ExampleCertificatesClient_NewListPager() { // 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 68d4fff35f43..c211f26c6d8a 100644 --- a/sdk/resourcemanager/nginx/armnginx/client_factory.go +++ b/sdk/resourcemanager/nginx/armnginx/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,36 +26,43 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewCertificatesClient creates a new instance of CertificatesClient. func (c *ClientFactory) NewCertificatesClient() *CertificatesClient { - subClient, _ := NewCertificatesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &CertificatesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewConfigurationsClient creates a new instance of ConfigurationsClient. func (c *ClientFactory) NewConfigurationsClient() *ConfigurationsClient { - subClient, _ := NewConfigurationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ConfigurationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDeploymentsClient creates a new instance of DeploymentsClient. func (c *ClientFactory) NewDeploymentsClient() *DeploymentsClient { - subClient, _ := NewDeploymentsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DeploymentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/nginx/armnginx/configurations_client.go b/sdk/resourcemanager/nginx/armnginx/configurations_client.go index 55a0a598b16d..2cf220219ce3 100644 --- a/sdk/resourcemanager/nginx/armnginx/configurations_client.go +++ b/sdk/resourcemanager/nginx/armnginx/configurations_client.go @@ -43,10 +43,85 @@ func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCrede return client, nil } +// Analysis - Analyze an NGINX configuration without applying it to the NGINXaaS deployment +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01-preview +// - 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 +// - options - ConfigurationsClientAnalysisOptions contains the optional parameters for the ConfigurationsClient.Analysis method. +func (client *ConfigurationsClient) Analysis(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientAnalysisOptions) (ConfigurationsClientAnalysisResponse, error) { + var err error + const operationName = "ConfigurationsClient.Analysis" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.analysisCreateRequest(ctx, resourceGroupName, deploymentName, configurationName, options) + if err != nil { + return ConfigurationsClientAnalysisResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConfigurationsClientAnalysisResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConfigurationsClientAnalysisResponse{}, err + } + resp, err := client.analysisHandleResponse(httpResp) + return resp, err +} + +// analysisCreateRequest creates the Analysis request. +func (client *ConfigurationsClient) analysisCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientAnalysisOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-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 + } + return req, nil +} + +// analysisHandleResponse handles the Analysis response. +func (client *ConfigurationsClient) analysisHandleResponse(resp *http.Response) (ConfigurationsClientAnalysisResponse, error) { + result := ConfigurationsClientAnalysisResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AnalysisResult); err != nil { + return ConfigurationsClientAnalysisResponse{}, err + } + return result, nil +} + // BeginCreateOrUpdate - Create or update the NGINX configuration for given NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - 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 @@ -73,7 +148,7 @@ func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Create or update the NGINX configuration for given NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationsClient.BeginCreateOrUpdate" @@ -119,7 +194,7 @@ func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -134,7 +209,7 @@ func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Cont // BeginDelete - Reset the NGINX configuration of given NGINX deployment to default // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - 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 @@ -160,7 +235,7 @@ func (client *ConfigurationsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Reset the NGINX configuration of given NGINX deployment to default // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview func (client *ConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ConfigurationsClient.BeginDelete" @@ -206,7 +281,7 @@ func (client *ConfigurationsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +290,7 @@ func (client *ConfigurationsClient) deleteCreateRequest(ctx context.Context, res // Get - Get the NGINX configuration of given NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - 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 @@ -266,7 +341,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +358,7 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // NewListPager - List the NGINX configuration of given NGINX deployment. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - options - ConfigurationsClientListOptions contains the optional parameters for the ConfigurationsClient.NewListPager method. @@ -330,7 +405,7 @@ func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/nginx/armnginx/configurations_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/configurations_client_example_test.go index 9891e907ed39..f2707a0eabbc 100644 --- a/sdk/resourcemanager/nginx/armnginx/configurations_client_example_test.go +++ b/sdk/resourcemanager/nginx/armnginx/configurations_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_List.json func ExampleConfigurationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -61,7 +61,7 @@ func ExampleConfigurationsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_Get.json func ExampleConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -97,7 +97,7 @@ func ExampleConfigurationsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_CreateOrUpdate.json func ExampleConfigurationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,7 +137,7 @@ func ExampleConfigurationsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_Delete.json func ExampleConfigurationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -157,3 +157,38 @@ func ExampleConfigurationsClient_BeginDelete() { log.Fatalf("failed to pull the result: %v", err) } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-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 c9b12a5e1b1c..50060642e2db 100644 --- a/sdk/resourcemanager/nginx/armnginx/constants.go +++ b/sdk/resourcemanager/nginx/armnginx/constants.go @@ -10,7 +10,7 @@ package armnginx const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx" - moduleVersion = "v3.0.0" + moduleVersion = "v3.1.0-beta.1" ) // CreatedByType - The type of identity that created the resource. diff --git a/sdk/resourcemanager/nginx/armnginx/deployments_client.go b/sdk/resourcemanager/nginx/armnginx/deployments_client.go index fcc6f3c406d7..b90173160eee 100644 --- a/sdk/resourcemanager/nginx/armnginx/deployments_client.go +++ b/sdk/resourcemanager/nginx/armnginx/deployments_client.go @@ -46,7 +46,7 @@ func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredenti // BeginCreateOrUpdate - Create or update the NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - options - DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate @@ -72,7 +72,7 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour // CreateOrUpdate - Create or update the NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DeploymentsClient.BeginCreateOrUpdate" @@ -114,7 +114,7 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -129,7 +129,7 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Delete the NGINX deployment resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - options - DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. @@ -153,7 +153,7 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Delete the NGINX deployment resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DeploymentsClient.BeginDelete" @@ -195,7 +195,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +204,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour // Get - Get the NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of targeted NGINX deployment // - options - DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. @@ -250,7 +250,7 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (Deploym // NewListPager - List the NGINX deployments resources // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - options - DeploymentsClientListOptions contains the optional parameters for the DeploymentsClient.NewListPager method. func (client *DeploymentsClient) NewListPager(options *DeploymentsClientListOptions) *runtime.Pager[DeploymentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListResponse]{ @@ -304,7 +304,7 @@ func (client *DeploymentsClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +321,7 @@ func (client *DeploymentsClient) listHandleResponse(resp *http.Response) (Deploy // NewListByResourceGroupPager - List all NGINX deployments under the specified resource group. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DeploymentsClientListByResourceGroupOptions contains the optional parameters for the DeploymentsClient.NewListByResourceGroupPager // method. @@ -364,7 +364,7 @@ func (client *DeploymentsClient) listByResourceGroupCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -382,7 +382,7 @@ func (client *DeploymentsClient) listByResourceGroupHandleResponse(resp *http.Re // BeginUpdate - Update the NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - 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. @@ -406,7 +406,7 @@ func (client *DeploymentsClient) BeginUpdate(ctx context.Context, resourceGroupN // Update - Update the NGINX deployment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview func (client *DeploymentsClient) update(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DeploymentsClient.BeginUpdate" @@ -448,7 +448,7 @@ func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { diff --git a/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go index fb6940f5e268..149ce81b31d4 100644 --- a/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go +++ b/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go @@ -17,8 +17,8 @@ import ( "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/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Get.json -func ExampleDeploymentsClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-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) @@ -41,6 +41,66 @@ func ExampleDeploymentsClient_Get() { // 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"), + // }, + // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), + // 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{ + // 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-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"), + // }, // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ @@ -61,6 +121,18 @@ func ExampleDeploymentsClient_Get() { // }, // 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"), // }, @@ -68,7 +140,7 @@ func ExampleDeploymentsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Create.json func ExampleDeploymentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,6 +168,9 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { // 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"), + // }, // IPAddress: to.Ptr("1.1.1.1"), // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ @@ -117,6 +192,9 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { // }, // 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"), @@ -124,7 +202,7 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Update.json func ExampleDeploymentsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -152,6 +230,9 @@ func ExampleDeploymentsClient_BeginUpdate() { // 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"), + // }, // IPAddress: to.Ptr("1.1.1.1"), // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ @@ -173,6 +254,9 @@ func ExampleDeploymentsClient_BeginUpdate() { // }, // 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"), // }, @@ -183,7 +267,7 @@ func ExampleDeploymentsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Delete.json func ExampleDeploymentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -204,7 +288,7 @@ func ExampleDeploymentsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_List.json func ExampleDeploymentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -234,6 +318,9 @@ func ExampleDeploymentsClient_NewListPager() { // 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"), + // }, // IPAddress: to.Ptr("1.1.1.1"), // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ @@ -255,13 +342,16 @@ func ExampleDeploymentsClient_NewListPager() { // }, // 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/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_ListByResourceGroup.json func ExampleDeploymentsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -291,6 +381,9 @@ func ExampleDeploymentsClient_NewListByResourceGroupPager() { // 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"), + // }, // IPAddress: to.Ptr("1.1.1.1"), // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ @@ -312,6 +405,9 @@ func ExampleDeploymentsClient_NewListByResourceGroupPager() { // }, // 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/configurations_server.go b/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go index 690f920a70aa..18fe606652e2 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go @@ -25,6 +25,10 @@ import ( // ConfigurationsServer is a fake server for instances of the armnginx.ConfigurationsClient type. type ConfigurationsServer struct { + // Analysis is the fake for method ConfigurationsClient.Analysis + // HTTP status codes to indicate success: http.StatusOK + Analysis func(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *armnginx.ConfigurationsClientAnalysisOptions) (resp azfake.Responder[armnginx.ConfigurationsClientAnalysisResponse], errResp azfake.ErrorResponder) + // 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) @@ -75,6 +79,8 @@ func (c *ConfigurationsServerTransport) Do(req *http.Request) (*http.Response, e var err error switch method { + case "ConfigurationsClient.Analysis": + resp, err = c.dispatchAnalysis(req) case "ConfigurationsClient.BeginCreateOrUpdate": resp, err = c.dispatchBeginCreateOrUpdate(req) case "ConfigurationsClient.BeginDelete": @@ -94,6 +100,53 @@ func (c *ConfigurationsServerTransport) Do(req *http.Request) (*http.Response, e return resp, nil } +func (c *ConfigurationsServerTransport) dispatchAnalysis(req *http.Request) (*http.Response, error) { + if c.srv.Analysis == nil { + return nil, &nonRetriableError{errors.New("fake for method Analysis not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Nginx\.NginxPlus/nginxDeployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/configurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyze` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnginx.AnalysisCreate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + deploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentName")]) + if err != nil { + return nil, err + } + configurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationName")]) + if err != nil { + return nil, err + } + var options *armnginx.ConfigurationsClientAnalysisOptions + if !reflect.ValueOf(body).IsZero() { + options = &armnginx.ConfigurationsClientAnalysisOptions{ + Body: &body, + } + } + respr, errRespr := c.srv.Analysis(req.Context(), resourceGroupNameParam, deploymentNameParam, configurationNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AnalysisResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (c *ConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { if c.srv.BeginCreateOrUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} diff --git a/sdk/resourcemanager/nginx/armnginx/fake/time_rfc3339.go b/sdk/resourcemanager/nginx/armnginx/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/time_rfc3339.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // 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+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + 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 @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + 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 { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + 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)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { 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 @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/nginx/armnginx/go.mod b/sdk/resourcemanager/nginx/armnginx/go.mod index 843bd49869fd..b823f31a4fa9 100644 --- a/sdk/resourcemanager/nginx/armnginx/go.mod +++ b/sdk/resourcemanager/nginx/armnginx/go.mod @@ -4,16 +4,16 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect - github.com/golang-jwt/jwt/v5 v5.0.0 // indirect - github.com/google/uuid v1.3.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect + github.com/golang-jwt/jwt/v5 v5.2.0 // indirect + github.com/google/uuid v1.5.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect golang.org/x/crypto v0.19.0 // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/sys v0.17.0 // indirect diff --git a/sdk/resourcemanager/nginx/armnginx/go.sum b/sdk/resourcemanager/nginx/armnginx/go.sum index 0766d184c256..a4a966ae2630 100644 --- a/sdk/resourcemanager/nginx/armnginx/go.sum +++ b/sdk/resourcemanager/nginx/armnginx/go.sum @@ -1,28 +1,28 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= -github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= +github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/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/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= diff --git a/sdk/resourcemanager/nginx/armnginx/models.go b/sdk/resourcemanager/nginx/armnginx/models.go index 2be4406f1a7f..5a53175a4905 100644 --- a/sdk/resourcemanager/nginx/armnginx/models.go +++ b/sdk/resourcemanager/nginx/armnginx/models.go @@ -10,6 +10,62 @@ package armnginx import "time" +// AnalysisCreate - The request body for creating an analysis for an NGINX configuration. +type AnalysisCreate struct { + // REQUIRED + Config *AnalysisCreateConfig +} + +type AnalysisCreateConfig struct { + Files []*ConfigurationFile + Package *ConfigurationPackage + ProtectedFiles []*ConfigurationFile + + // The root file of the NGINX config file(s). It must match one of the files' filepath. + RootFile *string +} + +// AnalysisDiagnostic - An error object found during the analysis of an NGINX configuration. +type AnalysisDiagnostic struct { + // REQUIRED + Description *string + + // REQUIRED + Directive *string + + // REQUIRED; the filepath of the most relevant config file + File *string + + // REQUIRED + Line *float32 + + // REQUIRED + Message *string + + // REQUIRED + Rule *string + + // Unique identifier for the error + ID *string +} + +// AnalysisResult - The response body for an analysis request. Contains the status of the analysis and any errors. +type AnalysisResult struct { + // REQUIRED; The status of the analysis. + Status *string + Data *AnalysisResultData +} + +type AnalysisResultData struct { + Errors []*AnalysisDiagnostic +} + +// AutoUpgradeProfile - Autoupgrade settings of a deployment. +type AutoUpgradeProfile struct { + // REQUIRED; Channel used for autoupgrade. + UpgradeChannel *string +} + type Certificate struct { Location *string Properties *CertificateProperties @@ -27,18 +83,33 @@ type Certificate struct { Type *string } +type CertificateErrorResponseBody struct { + Code *string + Message *string +} + type CertificateListResponse struct { NextLink *string Value []*Certificate } type CertificateProperties struct { + CertificateError *CertificateErrorResponseBody CertificateVirtualPath *string KeyVaultSecretID *string KeyVirtualPath *string + // READ-ONLY + KeyVaultSecretCreated *time.Time + + // READ-ONLY + KeyVaultSecretVersion *string + // READ-ONLY ProvisioningState *ProvisioningState + + // READ-ONLY + SHA1Thumbprint *string } type Configuration struct { @@ -115,14 +186,18 @@ type DeploymentListResponse struct { } type DeploymentProperties struct { + // Autoupgrade settings of a deployment. + AutoUpgradeProfile *AutoUpgradeProfile EnableDiagnosticsSupport *bool Logging *Logging // The managed resource group to deploy VNet injection related network resources. ManagedResourceGroup *string NetworkProfile *NetworkProfile - ScalingProperties *DeploymentScalingProperties - UserProfile *DeploymentUserProfile + + // Information on how the deployment will be scaled. + ScalingProperties *DeploymentScalingProperties + UserProfile *DeploymentUserProfile // READ-ONLY; The IP address of the deployment. IPAddress *string @@ -134,8 +209,18 @@ type DeploymentProperties struct { ProvisioningState *ProvisioningState } +// DeploymentScalingProperties - Information on how the deployment will be scaled. type DeploymentScalingProperties struct { - Capacity *int32 + // The settings for enabling automatic scaling of the deployment. If this field is specified, 'scale.capacity' must be empty. + AutoScaleSettings *DeploymentScalingPropertiesAutoScaleSettings + Capacity *int32 +} + +// DeploymentScalingPropertiesAutoScaleSettings - The settings for enabling automatic scaling of the deployment. If this field +// is specified, 'scale.capacity' must be empty. +type DeploymentScalingPropertiesAutoScaleSettings struct { + // REQUIRED + Profiles []*ScaleProfile } type DeploymentUpdateParameters struct { @@ -149,10 +234,14 @@ type DeploymentUpdateParameters struct { } type DeploymentUpdateProperties struct { + // Autoupgrade settings of a deployment. + AutoUpgradeProfile *AutoUpgradeProfile EnableDiagnosticsSupport *bool Logging *Logging - ScalingProperties *DeploymentScalingProperties - UserProfile *DeploymentUserProfile + + // Information on how the deployment will be scaled. + ScalingProperties *DeploymentScalingProperties + UserProfile *DeploymentUserProfile } type DeploymentUserProfile struct { @@ -161,13 +250,6 @@ type DeploymentUserProfile struct { PreferredEmail *string } -type ErrorResponseBody struct { - Code *string - Details []*ErrorResponseBody - Message *string - Target *string -} - type FrontendIPConfiguration struct { PrivateIPAddresses []*PrivateIPAddress PublicIPAddresses []*PublicIPAddress @@ -245,15 +327,29 @@ type PublicIPAddress struct { ID *string } -type ResourceProviderDefaultErrorResponse struct { - Error *ErrorResponseBody -} - type ResourceSKU struct { // REQUIRED; Name of the SKU. Name *string } +// ScaleProfile - The autoscale profile. +type ScaleProfile struct { + // REQUIRED; The capacity parameters of the profile. + Capacity *ScaleProfileCapacity + + // REQUIRED + Name *string +} + +// ScaleProfileCapacity - The capacity parameters of the profile. +type ScaleProfileCapacity struct { + // REQUIRED; The maximum number of NCUs the deployment can be autoscaled to. + Max *int32 + + // REQUIRED; The minimum number of NCUs the deployment can be autoscaled to. + Min *int32 +} + type StorageAccount struct { AccountName *string ContainerName *string diff --git a/sdk/resourcemanager/nginx/armnginx/models_serde.go b/sdk/resourcemanager/nginx/armnginx/models_serde.go index da1969d64a0a..d9d017e54741 100644 --- a/sdk/resourcemanager/nginx/armnginx/models_serde.go +++ b/sdk/resourcemanager/nginx/armnginx/models_serde.go @@ -15,6 +15,208 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type AnalysisCreate. +func (a AnalysisCreate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "config", a.Config) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnalysisCreate. +func (a *AnalysisCreate) 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 "config": + err = unpopulate(val, "Config", &a.Config) + 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 AnalysisCreateConfig. +func (a AnalysisCreateConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "files", a.Files) + populate(objectMap, "package", a.Package) + populate(objectMap, "protectedFiles", a.ProtectedFiles) + populate(objectMap, "rootFile", a.RootFile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnalysisCreateConfig. +func (a *AnalysisCreateConfig) 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 "files": + err = unpopulate(val, "Files", &a.Files) + delete(rawMsg, key) + case "package": + err = unpopulate(val, "Package", &a.Package) + delete(rawMsg, key) + case "protectedFiles": + err = unpopulate(val, "ProtectedFiles", &a.ProtectedFiles) + delete(rawMsg, key) + case "rootFile": + err = unpopulate(val, "RootFile", &a.RootFile) + 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 AnalysisDiagnostic. +func (a AnalysisDiagnostic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", a.Description) + populate(objectMap, "directive", a.Directive) + populate(objectMap, "file", a.File) + populate(objectMap, "id", a.ID) + populate(objectMap, "line", a.Line) + populate(objectMap, "message", a.Message) + populate(objectMap, "rule", a.Rule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnalysisDiagnostic. +func (a *AnalysisDiagnostic) 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 "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "directive": + err = unpopulate(val, "Directive", &a.Directive) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &a.File) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "line": + err = unpopulate(val, "Line", &a.Line) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "rule": + err = unpopulate(val, "Rule", &a.Rule) + 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 AnalysisResult. +func (a AnalysisResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "data", a.Data) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnalysisResult. +func (a *AnalysisResult) 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 "data": + err = unpopulate(val, "Data", &a.Data) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + 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 AnalysisResultData. +func (a AnalysisResultData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errors", a.Errors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnalysisResultData. +func (a *AnalysisResultData) 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 "errors": + err = unpopulate(val, "Errors", &a.Errors) + 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 AutoUpgradeProfile. +func (a AutoUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "upgradeChannel", a.UpgradeChannel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoUpgradeProfile. +func (a *AutoUpgradeProfile) 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 "upgradeChannel": + err = unpopulate(val, "UpgradeChannel", &a.UpgradeChannel) + 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) @@ -62,6 +264,37 @@ func (c *Certificate) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CertificateErrorResponseBody. +func (c CertificateErrorResponseBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", c.Code) + populate(objectMap, "message", c.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateErrorResponseBody. +func (c *CertificateErrorResponseBody) 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 "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + 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 CertificateListResponse. func (c CertificateListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -96,10 +329,14 @@ func (c *CertificateListResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CertificateProperties. func (c CertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "certificateError", c.CertificateError) populate(objectMap, "certificateVirtualPath", c.CertificateVirtualPath) + populateDateTimeRFC3339(objectMap, "keyVaultSecretCreated", c.KeyVaultSecretCreated) populate(objectMap, "keyVaultSecretId", c.KeyVaultSecretID) + populate(objectMap, "keyVaultSecretVersion", c.KeyVaultSecretVersion) populate(objectMap, "keyVirtualPath", c.KeyVirtualPath) populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sha1Thumbprint", c.SHA1Thumbprint) return json.Marshal(objectMap) } @@ -112,18 +349,30 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "certificateError": + err = unpopulate(val, "CertificateError", &c.CertificateError) + delete(rawMsg, key) case "certificateVirtualPath": err = unpopulate(val, "CertificateVirtualPath", &c.CertificateVirtualPath) delete(rawMsg, key) + case "keyVaultSecretCreated": + err = unpopulateDateTimeRFC3339(val, "KeyVaultSecretCreated", &c.KeyVaultSecretCreated) + delete(rawMsg, key) case "keyVaultSecretId": err = unpopulate(val, "KeyVaultSecretID", &c.KeyVaultSecretID) delete(rawMsg, key) + case "keyVaultSecretVersion": + err = unpopulate(val, "KeyVaultSecretVersion", &c.KeyVaultSecretVersion) + delete(rawMsg, key) case "keyVirtualPath": err = unpopulate(val, "KeyVirtualPath", &c.KeyVirtualPath) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) + case "sha1Thumbprint": + err = unpopulate(val, "SHA1Thumbprint", &c.SHA1Thumbprint) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -408,6 +657,7 @@ func (d *DeploymentListResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeploymentProperties. func (d DeploymentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "autoUpgradeProfile", d.AutoUpgradeProfile) populate(objectMap, "enableDiagnosticsSupport", d.EnableDiagnosticsSupport) populate(objectMap, "ipAddress", d.IPAddress) populate(objectMap, "logging", d.Logging) @@ -429,6 +679,9 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "autoUpgradeProfile": + err = unpopulate(val, "AutoUpgradeProfile", &d.AutoUpgradeProfile) + delete(rawMsg, key) case "enableDiagnosticsSupport": err = unpopulate(val, "EnableDiagnosticsSupport", &d.EnableDiagnosticsSupport) delete(rawMsg, key) @@ -467,6 +720,7 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeploymentScalingProperties. func (d DeploymentScalingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "autoScaleSettings", d.AutoScaleSettings) populate(objectMap, "capacity", d.Capacity) return json.Marshal(objectMap) } @@ -480,6 +734,9 @@ func (d *DeploymentScalingProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "autoScaleSettings": + err = unpopulate(val, "AutoScaleSettings", &d.AutoScaleSettings) + delete(rawMsg, key) case "capacity": err = unpopulate(val, "Capacity", &d.Capacity) delete(rawMsg, key) @@ -491,6 +748,33 @@ func (d *DeploymentScalingProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeploymentScalingPropertiesAutoScaleSettings. +func (d DeploymentScalingPropertiesAutoScaleSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "profiles", d.Profiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentScalingPropertiesAutoScaleSettings. +func (d *DeploymentScalingPropertiesAutoScaleSettings) 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 "profiles": + err = unpopulate(val, "Profiles", &d.Profiles) + 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 DeploymentUpdateParameters. func (d DeploymentUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -537,6 +821,7 @@ func (d *DeploymentUpdateParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeploymentUpdateProperties. func (d DeploymentUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "autoUpgradeProfile", d.AutoUpgradeProfile) populate(objectMap, "enableDiagnosticsSupport", d.EnableDiagnosticsSupport) populate(objectMap, "logging", d.Logging) populate(objectMap, "scalingProperties", d.ScalingProperties) @@ -553,6 +838,9 @@ func (d *DeploymentUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "autoUpgradeProfile": + err = unpopulate(val, "AutoUpgradeProfile", &d.AutoUpgradeProfile) + delete(rawMsg, key) case "enableDiagnosticsSupport": err = unpopulate(val, "EnableDiagnosticsSupport", &d.EnableDiagnosticsSupport) delete(rawMsg, key) @@ -600,45 +888,6 @@ func (d *DeploymentUserProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. -func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. -func (e *ErrorResponseBody) 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", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type FrontendIPConfiguration. func (f FrontendIPConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -961,15 +1210,15 @@ func (p *PublicIPAddress) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceProviderDefaultErrorResponse. -func (r ResourceProviderDefaultErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceSKU. +func (r ResourceSKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", r.Error) + populate(objectMap, "name", r.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderDefaultErrorResponse. -func (r *ResourceProviderDefaultErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU. +func (r *ResourceSKU) 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) @@ -977,8 +1226,8 @@ func (r *ResourceProviderDefaultErrorResponse) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &r.Error) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) } if err != nil { @@ -988,28 +1237,63 @@ func (r *ResourceProviderDefaultErrorResponse) 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 ScaleProfile. +func (s ScaleProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", r.Name) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "name", s.Name) 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 ScaleProfile. +func (s *ScaleProfile) 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 "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &s.Name) 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 +} + +// MarshalJSON implements the json.Marshaller interface for type ScaleProfileCapacity. +func (s ScaleProfileCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "max", s.Max) + populate(objectMap, "min", s.Min) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleProfileCapacity. +func (s *ScaleProfileCapacity) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "max": + err = unpopulate(val, "Max", &s.Max) + delete(rawMsg, key) + case "min": + err = unpopulate(val, "Min", &s.Min) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil @@ -1135,7 +1419,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/nginx/armnginx/operations_client.go b/sdk/resourcemanager/nginx/armnginx/operations_client.go index 6313c4af1462..a74ba175f1d3 100644 --- a/sdk/resourcemanager/nginx/armnginx/operations_client.go +++ b/sdk/resourcemanager/nginx/armnginx/operations_client.go @@ -37,9 +37,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. +// NewListPager - List all operations provided by Nginx.NginxPlus for the 2024-01-01-preview api version. // -// Generated from API version 2023-04-01 +// Generated from API version 2024-01-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/nginx/armnginx/operations_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/operations_client_example_test.go index a6d1870578ae..979b2a6634d4 100644 --- a/sdk/resourcemanager/nginx/armnginx/operations_client_example_test.go +++ b/sdk/resourcemanager/nginx/armnginx/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/nginx/armnginx/options.go b/sdk/resourcemanager/nginx/armnginx/options.go index ee1357a96fad..91776fc61795 100644 --- a/sdk/resourcemanager/nginx/armnginx/options.go +++ b/sdk/resourcemanager/nginx/armnginx/options.go @@ -34,6 +34,12 @@ type CertificatesClientListOptions struct { // placeholder for future optional parameters } +// ConfigurationsClientAnalysisOptions contains the optional parameters for the ConfigurationsClient.Analysis method. +type ConfigurationsClientAnalysisOptions struct { + // The NGINX configuration to analyze + Body *AnalysisCreate +} + // ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate // method. type ConfigurationsClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/nginx/armnginx/response_types.go b/sdk/resourcemanager/nginx/armnginx/responses.go similarity index 91% rename from sdk/resourcemanager/nginx/armnginx/response_types.go rename to sdk/resourcemanager/nginx/armnginx/responses.go index 9a86ca1bc55b..d10552acc9ab 100644 --- a/sdk/resourcemanager/nginx/armnginx/response_types.go +++ b/sdk/resourcemanager/nginx/armnginx/responses.go @@ -28,6 +28,12 @@ type CertificatesClientListResponse struct { CertificateListResponse } +// ConfigurationsClientAnalysisResponse contains the response from method ConfigurationsClient.Analysis. +type ConfigurationsClientAnalysisResponse struct { + // The response body for an analysis request. Contains the status of the analysis and any errors. + AnalysisResult +} + // ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.BeginCreateOrUpdate. type ConfigurationsClientCreateOrUpdateResponse struct { Configuration diff --git a/sdk/resourcemanager/nginx/armnginx/time_rfc3339.go b/sdk/resourcemanager/nginx/armnginx/time_rfc3339.go index 7681d76aba0e..a1bd429f7483 100644 --- a/sdk/resourcemanager/nginx/armnginx/time_rfc3339.go +++ b/sdk/resourcemanager/nginx/armnginx/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // 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+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + 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 @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + 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 { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + 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)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { 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 @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339