From d926f55de3cd5d879e883fd7e9fa0edda410c29a Mon Sep 17 00:00:00 2001 From: ReleaseHelper Date: Wed, 5 Feb 2025 01:08:10 +0000 Subject: [PATCH 1/2] [Release] sdk/resourcemanager/nginx/armnginx/3.1.0-beta.2 generation from spec commit: b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e --- .../nginx/armnginx/CHANGELOG.md | 47 ++ sdk/resourcemanager/nginx/armnginx/README.md | 2 +- .../nginx/armnginx/apikeys_client.go | 311 ++++++++ .../armnginx/apikeys_client_example_test.go | 139 ++++ .../nginx/armnginx/autorest.md | 8 +- .../nginx/armnginx/certificates_client.go | 22 +- .../certificates_client_example_test.go | 8 +- .../nginx/armnginx/client_factory.go | 10 +- .../nginx/armnginx/configurations_client.go | 28 +- .../configurations_client_example_test.go | 32 +- .../nginx/armnginx/constants.go | 34 +- .../nginx/armnginx/deployments_client.go | 32 +- .../deployments_client_example_test.go | 226 +++++- .../nginx/armnginx/fake/apikeys_server.go | 253 +++++++ .../armnginx/fake/configurations_server.go | 4 +- .../nginx/armnginx/fake/server_factory.go | 5 + sdk/resourcemanager/nginx/armnginx/go.mod | 4 +- sdk/resourcemanager/nginx/armnginx/go.sum | 14 +- sdk/resourcemanager/nginx/armnginx/models.go | 233 +++++- .../nginx/armnginx/models_serde.go | 682 ++++++++++++++++-- .../nginx/armnginx/operations_client.go | 6 +- .../operations_client_example_test.go | 2 +- sdk/resourcemanager/nginx/armnginx/options.go | 23 +- .../nginx/armnginx/responses.go | 24 +- 24 files changed, 1977 insertions(+), 172 deletions(-) create mode 100644 sdk/resourcemanager/nginx/armnginx/apikeys_client.go create mode 100644 sdk/resourcemanager/nginx/armnginx/apikeys_client_example_test.go create mode 100644 sdk/resourcemanager/nginx/armnginx/fake/apikeys_server.go diff --git a/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md b/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md index 37611e369554..06d55e1347e8 100644 --- a/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md +++ b/sdk/resourcemanager/nginx/armnginx/CHANGELOG.md @@ -1,5 +1,52 @@ # Release History +## 3.1.0-beta.2 (2025-02-27) +### Breaking Changes + +- Type of `AnalysisCreateConfig.ProtectedFiles` has been changed from `[]*ConfigurationFile` to `[]*ConfigurationProtectedFileRequest` +- Type of `ConfigurationListResponse.Value` has been changed from `[]*Configuration` to `[]*ConfigurationResponse` +- Type of `ConfigurationsClientBeginCreateOrUpdateOptions.Body` has been changed from `*Configuration` to `*ConfigurationRequest` +- Struct `Configuration` has been removed +- Struct `ConfigurationProperties` has been removed +- Field `Configuration` of struct `ConfigurationsClientCreateOrUpdateResponse` has been removed +- Field `Configuration` of struct `ConfigurationsClientGetResponse` has been removed +- Field `ManagedResourceGroup` of struct `DeploymentProperties` has been removed + +### Features Added + +- New enum type `ActivationState` with values `ActivationStateDisabled`, `ActivationStateEnabled` +- New enum type `Level` with values `LevelInfo`, `LevelWarning` +- New function `NewAPIKeysClient(string, azcore.TokenCredential, *arm.ClientOptions) (*APIKeysClient, error)` +- New function `*APIKeysClient.CreateOrUpdate(context.Context, string, string, string, *APIKeysClientCreateOrUpdateOptions) (APIKeysClientCreateOrUpdateResponse, error)` +- New function `*APIKeysClient.Delete(context.Context, string, string, string, *APIKeysClientDeleteOptions) (APIKeysClientDeleteResponse, error)` +- New function `*APIKeysClient.Get(context.Context, string, string, string, *APIKeysClientGetOptions) (APIKeysClientGetResponse, error)` +- New function `*APIKeysClient.NewListPager(string, string, *APIKeysClientListOptions) *runtime.Pager[APIKeysClientListResponse]` +- New function `*ClientFactory.NewAPIKeysClient() *APIKeysClient` +- New struct `ConfigurationProtectedFileRequest` +- New struct `ConfigurationProtectedFileResponse` +- New struct `ConfigurationRequest` +- New struct `ConfigurationRequestProperties` +- New struct `ConfigurationResponse` +- New struct `ConfigurationResponseProperties` +- New struct `DeploymentAPIKeyListResponse` +- New struct `DeploymentAPIKeyRequest` +- New struct `DeploymentAPIKeyRequestProperties` +- New struct `DeploymentAPIKeyResponse` +- New struct `DeploymentAPIKeyResponseProperties` +- New struct `DeploymentPropertiesNginxAppProtect` +- New struct `DeploymentUpdatePropertiesNginxAppProtect` +- New struct `DiagnosticItem` +- New struct `WebApplicationFirewallComponentVersions` +- New struct `WebApplicationFirewallPackage` +- New struct `WebApplicationFirewallSettings` +- New struct `WebApplicationFirewallStatus` +- New field `Diagnostics` in struct `AnalysisResultData` +- New anonymous field `ConfigurationResponse` in struct `ConfigurationsClientCreateOrUpdateResponse` +- New anonymous field `ConfigurationResponse` in struct `ConfigurationsClientGetResponse` +- New field `DataplaneAPIEndpoint`, `NginxAppProtect` in struct `DeploymentProperties` +- New field `NetworkProfile`, `NginxAppProtect` in struct `DeploymentUpdateProperties` + + ## 3.1.0-beta.1 (2024-03-22) ### Features Added diff --git a/sdk/resourcemanager/nginx/armnginx/README.md b/sdk/resourcemanager/nginx/armnginx/README.md index 648dd143a12c..2fa2a5c49036 100644 --- a/sdk/resourcemanager/nginx/armnginx/README.md +++ b/sdk/resourcemanager/nginx/armnginx/README.md @@ -55,7 +55,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.NewCertificatesClient() +client := clientFactory.NewAPIKeysClient() ``` ## Fakes diff --git a/sdk/resourcemanager/nginx/armnginx/apikeys_client.go b/sdk/resourcemanager/nginx/armnginx/apikeys_client.go new file mode 100644 index 000000000000..5a26e1db827d --- /dev/null +++ b/sdk/resourcemanager/nginx/armnginx/apikeys_client.go @@ -0,0 +1,311 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnginx + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// APIKeysClient contains the methods for the APIKeys group. +// Don't use this type directly, use NewAPIKeysClient() instead. +type APIKeysClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAPIKeysClient creates a new instance of APIKeysClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAPIKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APIKeysClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &APIKeysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deploymentName - The name of targeted NGINX deployment +// - apiKeyName - The resource name of the API key +// - options - APIKeysClientCreateOrUpdateOptions contains the optional parameters for the APIKeysClient.CreateOrUpdate method. +func (client *APIKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientCreateOrUpdateOptions) (APIKeysClientCreateOrUpdateResponse, error) { + var err error + const operationName = "APIKeysClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, apiKeyName, options) + if err != nil { + return APIKeysClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIKeysClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return APIKeysClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *APIKeysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + 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 apiKeyName == "" { + return nil, errors.New("parameter apiKeyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiKeyName}", url.PathEscape(apiKeyName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *APIKeysClient) createOrUpdateHandleResponse(resp *http.Response) (APIKeysClientCreateOrUpdateResponse, error) { + result := APIKeysClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentAPIKeyResponse); err != nil { + return APIKeysClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete API key for Nginx deployment +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deploymentName - The name of targeted NGINX deployment +// - apiKeyName - The resource name of the API key +// - options - APIKeysClientDeleteOptions contains the optional parameters for the APIKeysClient.Delete method. +func (client *APIKeysClient) Delete(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientDeleteOptions) (APIKeysClientDeleteResponse, error) { + var err error + const operationName = "APIKeysClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, deploymentName, apiKeyName, options) + if err != nil { + return APIKeysClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIKeysClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return APIKeysClientDeleteResponse{}, err + } + return APIKeysClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *APIKeysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + 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 apiKeyName == "" { + return nil, errors.New("parameter apiKeyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiKeyName}", url.PathEscape(apiKeyName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified API Key of the given Nginx deployment +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deploymentName - The name of targeted NGINX deployment +// - apiKeyName - The resource name of the API key +// - options - APIKeysClientGetOptions contains the optional parameters for the APIKeysClient.Get method. +func (client *APIKeysClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientGetOptions) (APIKeysClientGetResponse, error) { + var err error + const operationName = "APIKeysClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, deploymentName, apiKeyName, options) + if err != nil { + return APIKeysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return APIKeysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return APIKeysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *APIKeysClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *APIKeysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + 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 apiKeyName == "" { + return nil, errors.New("parameter apiKeyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{apiKeyName}", url.PathEscape(apiKeyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *APIKeysClient) getHandleResponse(resp *http.Response) (APIKeysClientGetResponse, error) { + result := APIKeysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentAPIKeyResponse); err != nil { + return APIKeysClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all API Keys of the given Nginx deployment +// +// Generated from API version 2024-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deploymentName - The name of targeted NGINX deployment +// - options - APIKeysClientListOptions contains the optional parameters for the APIKeysClient.NewListPager method. +func (client *APIKeysClient) NewListPager(resourceGroupName string, deploymentName string, options *APIKeysClientListOptions) *runtime.Pager[APIKeysClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[APIKeysClientListResponse]{ + More: func(page APIKeysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *APIKeysClientListResponse) (APIKeysClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "APIKeysClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, deploymentName, options) + }, nil) + if err != nil { + return APIKeysClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *APIKeysClient) listCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *APIKeysClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *APIKeysClient) listHandleResponse(resp *http.Response) (APIKeysClientListResponse, error) { + result := APIKeysClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentAPIKeyListResponse); err != nil { + return APIKeysClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/nginx/armnginx/apikeys_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/apikeys_client_example_test.go new file mode 100644 index 000000000000..470b1e33a188 --- /dev/null +++ b/sdk/resourcemanager/nginx/armnginx/apikeys_client_example_test.go @@ -0,0 +1,139 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnginx_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_CreateOrUpdate.json +func ExampleAPIKeysClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnginx.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAPIKeysClient().CreateOrUpdate(ctx, "myResourceGroup", "myDeployment", "myApiKey", &armnginx.APIKeysClientCreateOrUpdateOptions{Body: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DeploymentAPIKeyResponse = armnginx.DeploymentAPIKeyResponse{ + // Name: to.Ptr("myApiKey"), + // Type: to.Ptr("Nginx.NginxPlus/nginxDeployments/apiKeys"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/NGINX.NGINXPLUS/nginxDeployments/myDeployment/apiKeys/myApiKey"), + // Properties: &armnginx.DeploymentAPIKeyResponseProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-09-01T00:00:00.000Z"); return t}()), + // Hint: to.Ptr("000"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Delete.json +func ExampleAPIKeysClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnginx.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAPIKeysClient().Delete(ctx, "myResourceGroup", "myDeployment", "myApiKey", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Get.json +func ExampleAPIKeysClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnginx.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAPIKeysClient().Get(ctx, "myResourceGroup", "myDeployment", "myApiKey", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DeploymentAPIKeyResponse = armnginx.DeploymentAPIKeyResponse{ + // Name: to.Ptr("myApiKey"), + // Type: to.Ptr("Nginx.NginxPlus/nginxDeployments/apiKeys"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/apiKeys/myApiKey"), + // Properties: &armnginx.DeploymentAPIKeyResponseProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-09-01T00:00:00.000Z"); return t}()), + // Hint: to.Ptr("000"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_List.json +func ExampleAPIKeysClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnginx.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAPIKeysClient().NewListPager("myResourceGroup", "myDeployment", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.DeploymentAPIKeyListResponse = armnginx.DeploymentAPIKeyListResponse{ + // Value: []*armnginx.DeploymentAPIKeyResponse{ + // { + // Name: to.Ptr("myApiKey"), + // Type: to.Ptr("Nginx.NginxPlus/nginxDeployments/apiKeys"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/apiKeys/myApiKey"), + // Properties: &armnginx.DeploymentAPIKeyResponseProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-09-01T00:00:00.000Z"); return t}()), + // Hint: to.Ptr("000"), + // }, + // }, + // { + // Name: to.Ptr("myApiKey2"), + // Type: to.Ptr("Nginx.NginxPlus/nginxDeployments/apiKeys"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/apiKeys/myApiKey2"), + // Properties: &armnginx.DeploymentAPIKeyResponseProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-01T00:00:00.000Z"); return t}()), + // Hint: to.Ptr("111"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/nginx/armnginx/autorest.md b/sdk/resourcemanager/nginx/armnginx/autorest.md index d2af4678a73c..d63c4af7fc14 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 3.1.0-beta.1 -tag: package-2024-01-01-preview +module-version: 3.1.0-beta.2 +tag: package-2024-11-01-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/nginx/armnginx/certificates_client.go b/sdk/resourcemanager/nginx/armnginx/certificates_client.go index b657713d7d17..eeb09f525936 100644 --- a/sdk/resourcemanager/nginx/armnginx/certificates_client.go +++ b/sdk/resourcemanager/nginx/armnginx/certificates_client.go @@ -28,7 +28,7 @@ type CertificatesClient struct { } // NewCertificatesClient creates a new instance of CertificatesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CertificatesClient, error) { @@ -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 2024-01-01-preview +// Generated from API version 2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-01-preview func (client *CertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, certificateName string, options *CertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { 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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -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 2024-01-01-preview +// Generated from API version 2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 847341257d01..54b4981be8ad 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Get.json func ExampleCertificatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,7 +55,7 @@ func ExampleCertificatesClient_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/Certificates_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_CreateOrUpdate.json func ExampleCertificatesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -90,7 +90,7 @@ func ExampleCertificatesClient_BeginCreateOrUpdate() { // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Delete.json func ExampleCertificatesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -111,7 +111,7 @@ func ExampleCertificatesClient_BeginDelete() { } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_List.json func ExampleCertificatesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/nginx/armnginx/client_factory.go b/sdk/resourcemanager/nginx/armnginx/client_factory.go index c211f26c6d8a..93f042ea41fd 100644 --- a/sdk/resourcemanager/nginx/armnginx/client_factory.go +++ b/sdk/resourcemanager/nginx/armnginx/client_factory.go @@ -22,7 +22,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - 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) { @@ -36,6 +36,14 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewAPIKeysClient creates a new instance of APIKeysClient. +func (c *ClientFactory) NewAPIKeysClient() *APIKeysClient { + return &APIKeysClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewCertificatesClient creates a new instance of CertificatesClient. func (c *ClientFactory) NewCertificatesClient() *CertificatesClient { return &CertificatesClient{ diff --git a/sdk/resourcemanager/nginx/armnginx/configurations_client.go b/sdk/resourcemanager/nginx/armnginx/configurations_client.go index 2cf220219ce3..9324b9f1e0ef 100644 --- a/sdk/resourcemanager/nginx/armnginx/configurations_client.go +++ b/sdk/resourcemanager/nginx/armnginx/configurations_client.go @@ -28,7 +28,7 @@ type ConfigurationsClient struct { } // NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationsClient, error) { @@ -46,7 +46,7 @@ func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCrede // 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 +// Generated from API version 2024-11-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 @@ -97,7 +97,7 @@ func (client *ConfigurationsClient) analysisCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -121,7 +121,7 @@ func (client *ConfigurationsClient) analysisHandleResponse(resp *http.Response) // 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 2024-01-01-preview +// Generated from API version 2024-11-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 @@ -148,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 2024-01-01-preview +// Generated from API version 2024-11-01-preview func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, configurationName string, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationsClient.BeginCreateOrUpdate" @@ -194,7 +194,7 @@ func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -209,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 2024-01-01-preview +// Generated from API version 2024-11-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 @@ -235,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 2024-01-01-preview +// Generated from API version 2024-11-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" @@ -281,7 +281,7 @@ func (client *ConfigurationsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -290,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 2024-01-01-preview +// Generated from API version 2024-11-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 @@ -341,7 +341,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,7 +350,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour // getHandleResponse handles the Get response. func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsClientGetResponse, error) { result := ConfigurationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationResponse); err != nil { return ConfigurationsClientGetResponse{}, err } return result, nil @@ -358,7 +358,7 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // NewListPager - List the NGINX configuration of given NGINX deployment. // -// Generated from API version 2024-01-01-preview +// Generated from API version 2024-11-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. @@ -405,7 +405,7 @@ func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 f2707a0eabbc..2bb432ba058f 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_List.json func ExampleConfigurationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -40,12 +40,12 @@ func ExampleConfigurationsClient_NewListPager() { } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // page.ConfigurationListResponse = armnginx.ConfigurationListResponse{ - // Value: []*armnginx.Configuration{ + // Value: []*armnginx.ConfigurationResponse{ // { // Name: to.Ptr("default"), // Type: to.Ptr("nginx.nginxplus/nginxDeployments/configurations"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/configurations/default"), - // Properties: &armnginx.ConfigurationProperties{ + // Properties: &armnginx.ConfigurationResponseProperties{ // Files: []*armnginx.ConfigurationFile{ // { // Content: to.Ptr("ABCDEF=="), @@ -53,6 +53,11 @@ func ExampleConfigurationsClient_NewListPager() { // }}, // Package: &armnginx.ConfigurationPackage{ // }, + // ProtectedFiles: []*armnginx.ConfigurationProtectedFileResponse{ + // { + // ContentHash: to.Ptr("sha256:1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF"), + // VirtualPath: to.Ptr("/etc/nginx/protected-file.cert"), + // }}, // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), // RootFile: to.Ptr("/etc/nginx/nginx.conf"), // }, @@ -61,7 +66,7 @@ func ExampleConfigurationsClient_NewListPager() { } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Get.json func ExampleConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,11 +84,11 @@ func ExampleConfigurationsClient_Get() { // 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.Configuration = armnginx.Configuration{ + // res.ConfigurationResponse = armnginx.ConfigurationResponse{ // Name: to.Ptr("default"), // Type: to.Ptr("nginx.nginxplus/nginxDeployments/configurations"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/configurations/default"), - // Properties: &armnginx.ConfigurationProperties{ + // Properties: &armnginx.ConfigurationResponseProperties{ // Files: []*armnginx.ConfigurationFile{ // { // Content: to.Ptr("ABCDEF=="), @@ -91,13 +96,18 @@ func ExampleConfigurationsClient_Get() { // }}, // Package: &armnginx.ConfigurationPackage{ // }, + // ProtectedFiles: []*armnginx.ConfigurationProtectedFileResponse{ + // { + // ContentHash: to.Ptr("sha256:1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF"), + // VirtualPath: to.Ptr("/etc/nginx/protected-file.cert"), + // }}, // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), // RootFile: to.Ptr("/etc/nginx/nginx.conf"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_CreateOrUpdate.json func ExampleConfigurationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -119,11 +129,11 @@ func ExampleConfigurationsClient_BeginCreateOrUpdate() { // 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.Configuration = armnginx.Configuration{ + // res.ConfigurationResponse = armnginx.ConfigurationResponse{ // Name: to.Ptr("default"), // Type: to.Ptr("nginx.nginxplus/nginxDeployments/configurations"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment/configurations/default"), - // Properties: &armnginx.ConfigurationProperties{ + // Properties: &armnginx.ConfigurationResponseProperties{ // Files: []*armnginx.ConfigurationFile{ // { // Content: to.Ptr("ABCDEF=="), @@ -137,7 +147,7 @@ func ExampleConfigurationsClient_BeginCreateOrUpdate() { // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Delete.json func ExampleConfigurationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -158,7 +168,7 @@ func ExampleConfigurationsClient_BeginDelete() { } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Analysis.json func ExampleConfigurationsClient_Analysis() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/nginx/armnginx/constants.go b/sdk/resourcemanager/nginx/armnginx/constants.go index 50060642e2db..15032c4bae7c 100644 --- a/sdk/resourcemanager/nginx/armnginx/constants.go +++ b/sdk/resourcemanager/nginx/armnginx/constants.go @@ -10,9 +10,25 @@ package armnginx const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx" - moduleVersion = "v3.1.0-beta.1" + moduleVersion = "v3.1.0-beta.2" ) +// ActivationState - The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it. +type ActivationState string + +const ( + ActivationStateDisabled ActivationState = "Disabled" + ActivationStateEnabled ActivationState = "Enabled" +) + +// PossibleActivationStateValues returns the possible values for the ActivationState const type. +func PossibleActivationStateValues() []ActivationState { + return []ActivationState{ + ActivationStateDisabled, + ActivationStateEnabled, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -52,6 +68,22 @@ func PossibleIdentityTypeValues() []IdentityType { } } +// Level - Warning or Info +type Level string + +const ( + LevelInfo Level = "Info" + LevelWarning Level = "Warning" +) + +// PossibleLevelValues returns the possible values for the Level const type. +func PossibleLevelValues() []Level { + return []Level{ + LevelInfo, + LevelWarning, + } +} + type NginxPrivateIPAllocationMethod string const ( diff --git a/sdk/resourcemanager/nginx/armnginx/deployments_client.go b/sdk/resourcemanager/nginx/armnginx/deployments_client.go index b90173160eee..12e1ce3b1365 100644 --- a/sdk/resourcemanager/nginx/armnginx/deployments_client.go +++ b/sdk/resourcemanager/nginx/armnginx/deployments_client.go @@ -28,7 +28,7 @@ type DeploymentsClient struct { } // NewDeploymentsClient creates a new instance of DeploymentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentsClient, error) { @@ -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 2024-01-01-preview +// Generated from API version 2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -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 2024-01-01-preview +// Generated from API version 2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { diff --git a/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go b/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go index 149ce81b31d4..31fd36db0099 100644 --- a/sdk/resourcemanager/nginx/armnginx/deployments_client_example_test.go +++ b/sdk/resourcemanager/nginx/armnginx/deployments_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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get.json func ExampleDeploymentsClient_Get_deploymentsGet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -44,7 +44,7 @@ func ExampleDeploymentsClient_Get_deploymentsGet() { // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ // UpgradeChannel: to.Ptr("stable"), // }, - // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), + // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), // NetworkProfile: &armnginx.NetworkProfile{ // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ @@ -62,6 +62,29 @@ func ExampleDeploymentsClient_Get_deploymentsGet() { // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), // }, // }, + // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ + // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ + // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), + // }, + // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ + // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.21"), + // }, + // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.22"), + // }, + // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ + // WafEngineVersion: to.Ptr("10.624.0"), + // WafNginxVersion: to.Ptr("4.815.0"), + // }, + // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.23"), + // }, + // }, + // }, // NginxVersion: to.Ptr("nginx-1.19.6"), // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), // ScalingProperties: &armnginx.DeploymentScalingProperties{ @@ -74,7 +97,7 @@ func ExampleDeploymentsClient_Get_deploymentsGet() { // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get_AutoScale.json func ExampleDeploymentsClient_Get_deploymentsGetAutoScale() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,7 +124,6 @@ func ExampleDeploymentsClient_Get_deploymentsGetAutoScale() { // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ // UpgradeChannel: to.Ptr("stable"), // }, - // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ @@ -140,7 +162,7 @@ func ExampleDeploymentsClient_Get_deploymentsGetAutoScale() { // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Create.json func ExampleDeploymentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -171,8 +193,8 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ // UpgradeChannel: to.Ptr("stable"), // }, + // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), // IPAddress: to.Ptr("1.1.1.1"), - // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ @@ -190,6 +212,29 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), // }, // }, + // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ + // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ + // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), + // }, + // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ + // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.21"), + // }, + // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.22"), + // }, + // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ + // WafEngineVersion: to.Ptr("10.624.0"), + // WafNginxVersion: to.Ptr("4.815.0"), + // }, + // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.23"), + // }, + // }, + // }, // NginxVersion: to.Ptr("nginx-1.19.6"), // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), // ScalingProperties: &armnginx.DeploymentScalingProperties{ @@ -202,8 +247,8 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { // } } -// 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() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Update.json +func ExampleDeploymentsClient_BeginUpdate_deploymentsUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -233,8 +278,8 @@ func ExampleDeploymentsClient_BeginUpdate() { // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ // UpgradeChannel: to.Ptr("stable"), // }, + // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), // IPAddress: to.Ptr("1.1.1.1"), - // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ @@ -252,6 +297,113 @@ func ExampleDeploymentsClient_BeginUpdate() { // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), // }, // }, + // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ + // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ + // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), + // }, + // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ + // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.21"), + // }, + // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.22"), + // }, + // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ + // WafEngineVersion: to.Ptr("10.624.0"), + // WafNginxVersion: to.Ptr("4.815.0"), + // }, + // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.23"), + // }, + // }, + // }, + // NginxVersion: to.Ptr("nginx-1.19.6"), + // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), + // ScalingProperties: &armnginx.DeploymentScalingProperties{ + // Capacity: to.Ptr[int32](10), + // }, + // UserProfile: &armnginx.DeploymentUserProfile{ + // PreferredEmail: to.Ptr("example@example.email"), + // }, + // }, + // Tags: map[string]*string{ + // "Environment": to.Ptr("Dev"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_UpdateSubnet.json +func ExampleDeploymentsClient_BeginUpdate_deploymentsUpdateSubnet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnginx.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewDeploymentsClient().BeginUpdate(ctx, "myResourceGroup", "myDeployment", &armnginx.DeploymentsClientBeginUpdateOptions{Body: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Deployment = armnginx.Deployment{ + // Name: to.Ptr("myDeployment"), + // Type: to.Ptr("nginx.nginxplus/deployments"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Nginx.NginxPlus/nginxDeployments/myDeployment"), + // Location: to.Ptr("westus"), + // Properties: &armnginx.DeploymentProperties{ + // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ + // UpgradeChannel: to.Ptr("stable"), + // }, + // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), + // IPAddress: to.Ptr("1.1.1.1"), + // NetworkProfile: &armnginx.NetworkProfile{ + // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ + // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ + // }, + // PublicIPAddresses: []*armnginx.PublicIPAddress{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIPAddress"), + // }}, + // }, + // NetworkInterfaceConfiguration: &armnginx.NetworkInterfaceConfiguration{ + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet2/subnets/mySubnet"), + // }, + // }, + // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ + // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ + // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), + // }, + // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ + // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.21"), + // }, + // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.22"), + // }, + // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ + // WafEngineVersion: to.Ptr("10.624.0"), + // WafNginxVersion: to.Ptr("4.815.0"), + // }, + // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.23"), + // }, + // }, + // }, // NginxVersion: to.Ptr("nginx-1.19.6"), // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), // ScalingProperties: &armnginx.DeploymentScalingProperties{ @@ -267,7 +419,7 @@ func ExampleDeploymentsClient_BeginUpdate() { // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Delete.json func ExampleDeploymentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -288,7 +440,7 @@ func ExampleDeploymentsClient_BeginDelete() { } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_List.json func ExampleDeploymentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -321,8 +473,8 @@ func ExampleDeploymentsClient_NewListPager() { // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ // UpgradeChannel: to.Ptr("stable"), // }, + // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), // IPAddress: to.Ptr("1.1.1.1"), - // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ @@ -340,6 +492,29 @@ func ExampleDeploymentsClient_NewListPager() { // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), // }, // }, + // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ + // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ + // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), + // }, + // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ + // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.21"), + // }, + // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.22"), + // }, + // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ + // WafEngineVersion: to.Ptr("10.624.0"), + // WafNginxVersion: to.Ptr("4.815.0"), + // }, + // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.23"), + // }, + // }, + // }, // NginxVersion: to.Ptr("nginx-1.19.6"), // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), // ScalingProperties: &armnginx.DeploymentScalingProperties{ @@ -351,7 +526,7 @@ func ExampleDeploymentsClient_NewListPager() { } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_ListByResourceGroup.json func ExampleDeploymentsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -384,8 +559,8 @@ func ExampleDeploymentsClient_NewListByResourceGroupPager() { // AutoUpgradeProfile: &armnginx.AutoUpgradeProfile{ // UpgradeChannel: to.Ptr("stable"), // }, + // DataplaneAPIEndpoint: to.Ptr("mynginx-75b3bf22a555.eastus2.nginxaas.net"), // IPAddress: to.Ptr("1.1.1.1"), - // ManagedResourceGroup: to.Ptr("myManagedResourceGroup"), // NetworkProfile: &armnginx.NetworkProfile{ // FrontEndIPConfiguration: &armnginx.FrontendIPConfiguration{ // PrivateIPAddresses: []*armnginx.PrivateIPAddress{ @@ -403,6 +578,29 @@ func ExampleDeploymentsClient_NewListByResourceGroupPager() { // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), // }, // }, + // NginxAppProtect: &armnginx.DeploymentPropertiesNginxAppProtect{ + // WebApplicationFirewallSettings: &armnginx.WebApplicationFirewallSettings{ + // ActivationState: to.Ptr(armnginx.ActivationStateEnabled), + // }, + // WebApplicationFirewallStatus: &armnginx.WebApplicationFirewallStatus{ + // AttackSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-21T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.21"), + // }, + // BotSignaturesPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-22T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.22"), + // }, + // ComponentVersions: &armnginx.WebApplicationFirewallComponentVersions{ + // WafEngineVersion: to.Ptr("10.624.0"), + // WafNginxVersion: to.Ptr("4.815.0"), + // }, + // ThreatCampaignsPackage: &armnginx.WebApplicationFirewallPackage{ + // RevisionDatetime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-23T15:50:53.000Z"); return t}()), + // Version: to.Ptr("2024.02.23"), + // }, + // }, + // }, // NginxVersion: to.Ptr("nginx-1.19.6"), // ProvisioningState: to.Ptr(armnginx.ProvisioningStateSucceeded), // ScalingProperties: &armnginx.DeploymentScalingProperties{ diff --git a/sdk/resourcemanager/nginx/armnginx/fake/apikeys_server.go b/sdk/resourcemanager/nginx/armnginx/fake/apikeys_server.go new file mode 100644 index 000000000000..275abff146ce --- /dev/null +++ b/sdk/resourcemanager/nginx/armnginx/fake/apikeys_server.go @@ -0,0 +1,253 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/nginx/armnginx/v3" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// APIKeysServer is a fake server for instances of the armnginx.APIKeysClient type. +type APIKeysServer struct { + // CreateOrUpdate is the fake for method APIKeysClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *armnginx.APIKeysClientCreateOrUpdateOptions) (resp azfake.Responder[armnginx.APIKeysClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method APIKeysClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *armnginx.APIKeysClientDeleteOptions) (resp azfake.Responder[armnginx.APIKeysClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method APIKeysClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, deploymentName string, apiKeyName string, options *armnginx.APIKeysClientGetOptions) (resp azfake.Responder[armnginx.APIKeysClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method APIKeysClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, deploymentName string, options *armnginx.APIKeysClientListOptions) (resp azfake.PagerResponder[armnginx.APIKeysClientListResponse]) +} + +// NewAPIKeysServerTransport creates a new instance of APIKeysServerTransport with the provided implementation. +// The returned APIKeysServerTransport instance is connected to an instance of armnginx.APIKeysClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAPIKeysServerTransport(srv *APIKeysServer) *APIKeysServerTransport { + return &APIKeysServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armnginx.APIKeysClientListResponse]](), + } +} + +// APIKeysServerTransport connects instances of armnginx.APIKeysClient to instances of APIKeysServer. +// Don't use this type directly, use NewAPIKeysServerTransport instead. +type APIKeysServerTransport struct { + srv *APIKeysServer + newListPager *tracker[azfake.PagerResponder[armnginx.APIKeysClientListResponse]] +} + +// Do implements the policy.Transporter interface for APIKeysServerTransport. +func (a *APIKeysServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "APIKeysClient.CreateOrUpdate": + resp, err = a.dispatchCreateOrUpdate(req) + case "APIKeysClient.Delete": + resp, err = a.dispatchDelete(req) + case "APIKeysClient.Get": + resp, err = a.dispatchGet(req) + case "APIKeysClient.NewListPager": + resp, err = a.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *APIKeysServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate 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~%@]+)/apiKeys/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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.DeploymentAPIKeyRequest](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 + } + apiKeyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiKeyName")]) + if err != nil { + return nil, err + } + var options *armnginx.APIKeysClientCreateOrUpdateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armnginx.APIKeysClientCreateOrUpdateOptions{ + Body: &body, + } + } + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, deploymentNameParam, apiKeyNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeploymentAPIKeyResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *APIKeysServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete 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~%@]+)/apiKeys/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + 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 + } + apiKeyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiKeyName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, deploymentNameParam, apiKeyNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *APIKeysServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get 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~%@]+)/apiKeys/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + 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 + } + apiKeyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiKeyName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, deploymentNameParam, apiKeyNameParam, nil) + 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).DeploymentAPIKeyResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *APIKeysServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Nginx\.NginxPlus/nginxDeployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/apiKeys` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + 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 + } + resp := a.srv.NewListPager(resourceGroupNameParam, deploymentNameParam, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armnginx.APIKeysClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go b/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go index 18fe606652e2..3b1049a4ae32 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/configurations_server.go @@ -159,7 +159,7 @@ func (c *ConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Re if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armnginx.Configuration](req) + body, err := server.UnmarshalRequestAsJSON[armnginx.ConfigurationRequest](req) if err != nil { return nil, err } @@ -283,7 +283,7 @@ func (c *ConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Re 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).Configuration, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConfigurationResponse, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/nginx/armnginx/fake/server_factory.go b/sdk/resourcemanager/nginx/armnginx/fake/server_factory.go index 9f51f9425145..25e353dcbcc7 100644 --- a/sdk/resourcemanager/nginx/armnginx/fake/server_factory.go +++ b/sdk/resourcemanager/nginx/armnginx/fake/server_factory.go @@ -19,6 +19,7 @@ import ( // ServerFactory is a fake server for instances of the armnginx.ClientFactory type. type ServerFactory struct { + APIKeysServer APIKeysServer CertificatesServer CertificatesServer ConfigurationsServer ConfigurationsServer DeploymentsServer DeploymentsServer @@ -39,6 +40,7 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex + trAPIKeysServer *APIKeysServerTransport trCertificatesServer *CertificatesServerTransport trConfigurationsServer *ConfigurationsServerTransport trDeploymentsServer *DeploymentsServerTransport @@ -58,6 +60,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "APIKeysClient": + initServer(s, &s.trAPIKeysServer, func() *APIKeysServerTransport { return NewAPIKeysServerTransport(&s.srv.APIKeysServer) }) + resp, err = s.trAPIKeysServer.Do(req) case "CertificatesClient": initServer(s, &s.trCertificatesServer, func() *CertificatesServerTransport { return NewCertificatesServerTransport(&s.srv.CertificatesServer) }) resp, err = s.trCertificatesServer.Do(req) diff --git a/sdk/resourcemanager/nginx/armnginx/go.mod b/sdk/resourcemanager/nginx/armnginx/go.mod index fb7699a2021e..e5ca8d7c027f 100644 --- a/sdk/resourcemanager/nginx/armnginx/go.mod +++ b/sdk/resourcemanager/nginx/armnginx/go.mod @@ -4,12 +4,12 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect diff --git a/sdk/resourcemanager/nginx/armnginx/go.sum b/sdk/resourcemanager/nginx/armnginx/go.sum index 9620a8f197a3..74535695309f 100644 --- a/sdk/resourcemanager/nginx/armnginx/go.sum +++ b/sdk/resourcemanager/nginx/armnginx/go.sum @@ -1,27 +1,21 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 h1:B/dfvscEQtew9dVuoxqxrUKKv8Ih2f55PydknDamU+g= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0/go.mod h1:fiPSssYvltE08HJchL04dOy+RD4hgrjph0cwGGMntdI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.0 h1:+m0M/LFxN43KvULkDNfdXOgrjtg6UYJPFBJyuEcRCAw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 h1:kYRSnvJju5gYVyhkij+RTJ/VR6QIUaCfWeaFm2ycsjQ= -github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= diff --git a/sdk/resourcemanager/nginx/armnginx/models.go b/sdk/resourcemanager/nginx/armnginx/models.go index 5a53175a4905..056a6ade3d80 100644 --- a/sdk/resourcemanager/nginx/armnginx/models.go +++ b/sdk/resourcemanager/nginx/armnginx/models.go @@ -19,7 +19,7 @@ type AnalysisCreate struct { type AnalysisCreateConfig struct { Files []*ConfigurationFile Package *ConfigurationPackage - ProtectedFiles []*ConfigurationFile + ProtectedFiles []*ConfigurationProtectedFileRequest // The root file of the NGINX config file(s). It must match one of the files' filepath. RootFile *string @@ -57,7 +57,8 @@ type AnalysisResult struct { } type AnalysisResultData struct { - Errors []*AnalysisDiagnostic + Diagnostics []*DiagnosticItem + Errors []*AnalysisDiagnostic } // AutoUpgradeProfile - Autoupgrade settings of a deployment. @@ -112,9 +113,47 @@ type CertificateProperties struct { SHA1Thumbprint *string } -type Configuration struct { - Location *string - Properties *ConfigurationProperties +type ConfigurationFile struct { + Content *string + VirtualPath *string +} + +// ConfigurationListResponse - Response of a list operation. +type ConfigurationListResponse struct { + // Link to the next set of results, if any. + NextLink *string + + // Results of a list operation. + Value []*ConfigurationResponse +} + +type ConfigurationPackage struct { + Data *string + ProtectedFiles []*string +} + +type ConfigurationProtectedFileRequest struct { + // The content of the protected file. This value is a PUT only value. If you perform a GET request on this value, it will + // be empty because it is a protected file. + Content *string + + // The hash of the content of the file. This value is used to determine if the file has changed. + ContentHash *string + + // The virtual path of the protected file. + VirtualPath *string +} + +type ConfigurationProtectedFileResponse struct { + // The hash of the content of the file. This value is used to determine if the file has changed. + ContentHash *string + + // The virtual path of the protected file. + VirtualPath *string +} + +type ConfigurationRequest struct { + Properties *ConfigurationRequestProperties // READ-ONLY ID *string @@ -129,29 +168,36 @@ type Configuration struct { Type *string } -type ConfigurationFile struct { - Content *string - VirtualPath *string +type ConfigurationRequestProperties struct { + Files []*ConfigurationFile + Package *ConfigurationPackage + ProtectedFiles []*ConfigurationProtectedFileRequest + RootFile *string + + // READ-ONLY + ProvisioningState *ProvisioningState } -// ConfigurationListResponse - Response of a list operation. -type ConfigurationListResponse struct { - // Link to the next set of results, if any. - NextLink *string +type ConfigurationResponse struct { + Properties *ConfigurationResponseProperties - // Results of a list operation. - Value []*Configuration -} + // READ-ONLY + ID *string -type ConfigurationPackage struct { - Data *string - ProtectedFiles []*string + // READ-ONLY + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY + Type *string } -type ConfigurationProperties struct { +type ConfigurationResponseProperties struct { Files []*ConfigurationFile Package *ConfigurationPackage - ProtectedFiles []*ConfigurationFile + ProtectedFiles []*ConfigurationProtectedFileResponse RootFile *string // READ-ONLY @@ -180,6 +226,54 @@ type Deployment struct { Type *string } +type DeploymentAPIKeyListResponse struct { + NextLink *string + Value []*DeploymentAPIKeyResponse +} + +type DeploymentAPIKeyRequest struct { + Properties *DeploymentAPIKeyRequestProperties + + // READ-ONLY + ID *string + + // READ-ONLY + Name *string + + // READ-ONLY + Type *string +} + +type DeploymentAPIKeyRequestProperties struct { + // The time after which this Dataplane API Key is no longer valid. + EndDateTime *time.Time + + // Secret text to be used as a Dataplane API Key. This is a write only property that can never be read back, but the first + // three characters will be returned in the 'hint' property. + SecretText *string +} + +type DeploymentAPIKeyResponse struct { + Properties *DeploymentAPIKeyResponseProperties + + // READ-ONLY + ID *string + + // READ-ONLY + Name *string + + // READ-ONLY + Type *string +} + +type DeploymentAPIKeyResponseProperties struct { + // The time after which this Dataplane API Key is no longer valid. + EndDateTime *time.Time + + // READ-ONLY; The first three characters of the secret text to help identify it in use. This property is read-only. + Hint *string +} + type DeploymentListResponse struct { NextLink *string Value []*Deployment @@ -190,15 +284,18 @@ type DeploymentProperties struct { AutoUpgradeProfile *AutoUpgradeProfile EnableDiagnosticsSupport *bool Logging *Logging + NetworkProfile *NetworkProfile - // The managed resource group to deploy VNet injection related network resources. - ManagedResourceGroup *string - NetworkProfile *NetworkProfile + // Settings for NGINX App Protect (NAP) + NginxAppProtect *DeploymentPropertiesNginxAppProtect // Information on how the deployment will be scaled. ScalingProperties *DeploymentScalingProperties UserProfile *DeploymentUserProfile + // READ-ONLY; Dataplane API endpoint for the caller to update the NGINX state of the deployment. + DataplaneAPIEndpoint *string + // READ-ONLY; The IP address of the deployment. IPAddress *string @@ -209,6 +306,15 @@ type DeploymentProperties struct { ProvisioningState *ProvisioningState } +// DeploymentPropertiesNginxAppProtect - Settings for NGINX App Protect (NAP) +type DeploymentPropertiesNginxAppProtect struct { + // REQUIRED; Settings for the NGINX App Protect Web Application Firewall (WAF) + WebApplicationFirewallSettings *WebApplicationFirewallSettings + + // READ-ONLY; The status of the NGINX App Protect Web Application Firewall + WebApplicationFirewallStatus *WebApplicationFirewallStatus +} + // DeploymentScalingProperties - Information on how the deployment will be scaled. type DeploymentScalingProperties struct { // The settings for enabling automatic scaling of the deployment. If this field is specified, 'scale.capacity' must be empty. @@ -238,18 +344,59 @@ type DeploymentUpdateProperties struct { AutoUpgradeProfile *AutoUpgradeProfile EnableDiagnosticsSupport *bool Logging *Logging + NetworkProfile *NetworkProfile + + // Update settings for NGINX App Protect (NAP) + NginxAppProtect *DeploymentUpdatePropertiesNginxAppProtect // Information on how the deployment will be scaled. ScalingProperties *DeploymentScalingProperties UserProfile *DeploymentUserProfile } +// DeploymentUpdatePropertiesNginxAppProtect - Update settings for NGINX App Protect (NAP) +type DeploymentUpdatePropertiesNginxAppProtect struct { + // Settings for the NGINX App Protect Web Application Firewall (WAF) + WebApplicationFirewallSettings *WebApplicationFirewallSettings +} + type DeploymentUserProfile struct { // The preferred support contact email address of the user used for sending alerts and notification. Can be an empty string // or a valid email address. PreferredEmail *string } +// DiagnosticItem - A diagnostic is a message associated with an NGINX config. The Analyzer returns diagnostics with a level +// indicating the importance of the diagnostic with optional category. +type DiagnosticItem struct { + // REQUIRED + Description *string + + // REQUIRED + Directive *string + + // REQUIRED; The filepath of the most relevant config file. + File *string + + // REQUIRED; Warning or Info + Level *Level + + // REQUIRED + Line *float32 + + // REQUIRED + Message *string + + // REQUIRED + Rule *string + + // Category of warning like Best-practices, Recommendation, Security etc. + Category *string + + // Unique identifier for the diagnostic. + ID *string +} + type FrontendIPConfiguration struct { PrivateIPAddresses []*PrivateIPAddress PublicIPAddresses []*PublicIPAddress @@ -383,3 +530,43 @@ type UserIdentityProperties struct { // READ-ONLY PrincipalID *string } + +// WebApplicationFirewallComponentVersions - Versions of the NGINX App Protect Web Application Firewall (WAF) components. +type WebApplicationFirewallComponentVersions struct { + // REQUIRED; The version of the NGINX App Protect Web Application Firewall (WAF) engine. + WafEngineVersion *string + + // REQUIRED; The version of the NGINX App Protect Web Application Firewall (WAF) module for NGINX. + WafNginxVersion *string +} + +// WebApplicationFirewallPackage - NGINX App Protect Web Application Firewall (WAF) Package. Contains the version and revision +// date of the package. +type WebApplicationFirewallPackage struct { + // REQUIRED; The date and time of the package revision. + RevisionDatetime *time.Time + + // REQUIRED; The version of the NGINX App Protect Web Application Firewall (WAF) package. + Version *string +} + +// WebApplicationFirewallSettings - Settings for the NGINX App Protect Web Application Firewall (WAF) +type WebApplicationFirewallSettings struct { + // The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it. + ActivationState *ActivationState +} + +// WebApplicationFirewallStatus - The status of the NGINX App Protect Web Application Firewall +type WebApplicationFirewallStatus struct { + // READ-ONLY; Package containing attack signatures for the NGINX App Protect Web Application Firewall (WAF). + AttackSignaturesPackage *WebApplicationFirewallPackage + + // READ-ONLY; Package containing bot signatures for the NGINX App Protect Web Application Firewall (WAF). + BotSignaturesPackage *WebApplicationFirewallPackage + + // READ-ONLY; Versions of the NGINX App Protect Web Application Firewall (WAF) components. + ComponentVersions *WebApplicationFirewallComponentVersions + + // READ-ONLY; Package containing threat campaigns for the NGINX App Protect Web Application Firewall (WAF). + ThreatCampaignsPackage *WebApplicationFirewallPackage +} diff --git a/sdk/resourcemanager/nginx/armnginx/models_serde.go b/sdk/resourcemanager/nginx/armnginx/models_serde.go index d9d017e54741..fcc20547e394 100644 --- a/sdk/resourcemanager/nginx/armnginx/models_serde.go +++ b/sdk/resourcemanager/nginx/armnginx/models_serde.go @@ -166,6 +166,7 @@ func (a *AnalysisResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AnalysisResultData. func (a AnalysisResultData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "diagnostics", a.Diagnostics) populate(objectMap, "errors", a.Errors) return json.Marshal(objectMap) } @@ -179,6 +180,9 @@ func (a *AnalysisResultData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "diagnostics": + err = unpopulate(val, "Diagnostics", &a.Diagnostics) + delete(rawMsg, key) case "errors": err = unpopulate(val, "Errors", &a.Errors) delete(rawMsg, key) @@ -381,20 +385,16 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Configuration. -func (c Configuration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConfigurationFile. +func (c ConfigurationFile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) + populate(objectMap, "content", c.Content) + populate(objectMap, "virtualPath", c.VirtualPath) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Configuration. -func (c *Configuration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationFile. +func (c *ConfigurationFile) 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) @@ -402,23 +402,73 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) + case "content": + err = unpopulate(val, "Content", &c.Content) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) + case "virtualPath": + err = unpopulate(val, "VirtualPath", &c.VirtualPath) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationListResponse. +func (c ConfigurationListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationListResponse. +func (c *ConfigurationListResponse) 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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationPackage. +func (c ConfigurationPackage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "data", c.Data) + populate(objectMap, "protectedFiles", c.ProtectedFiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationPackage. +func (c *ConfigurationPackage) 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 "data": + err = unpopulate(val, "Data", &c.Data) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "protectedFiles": + err = unpopulate(val, "ProtectedFiles", &c.ProtectedFiles) delete(rawMsg, key) } if err != nil { @@ -428,16 +478,17 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationFile. -func (c ConfigurationFile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConfigurationProtectedFileRequest. +func (c ConfigurationProtectedFileRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "content", c.Content) + populate(objectMap, "contentHash", c.ContentHash) populate(objectMap, "virtualPath", c.VirtualPath) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationFile. -func (c *ConfigurationFile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationProtectedFileRequest. +func (c *ConfigurationProtectedFileRequest) 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) @@ -448,6 +499,9 @@ func (c *ConfigurationFile) UnmarshalJSON(data []byte) error { case "content": err = unpopulate(val, "Content", &c.Content) delete(rawMsg, key) + case "contentHash": + err = unpopulate(val, "ContentHash", &c.ContentHash) + delete(rawMsg, key) case "virtualPath": err = unpopulate(val, "VirtualPath", &c.VirtualPath) delete(rawMsg, key) @@ -459,16 +513,16 @@ func (c *ConfigurationFile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationListResponse. -func (c ConfigurationListResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConfigurationProtectedFileResponse. +func (c ConfigurationProtectedFileResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "contentHash", c.ContentHash) + populate(objectMap, "virtualPath", c.VirtualPath) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationListResponse. -func (c *ConfigurationListResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationProtectedFileResponse. +func (c *ConfigurationProtectedFileResponse) 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) @@ -476,11 +530,11 @@ func (c *ConfigurationListResponse) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + case "contentHash": + err = unpopulate(val, "ContentHash", &c.ContentHash) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "virtualPath": + err = unpopulate(val, "VirtualPath", &c.VirtualPath) delete(rawMsg, key) } if err != nil { @@ -490,16 +544,62 @@ func (c *ConfigurationListResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationPackage. -func (c ConfigurationPackage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConfigurationRequest. +func (c ConfigurationRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "data", c.Data) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationRequest. +func (c *ConfigurationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationRequestProperties. +func (c ConfigurationRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "files", c.Files) + populate(objectMap, "package", c.Package) populate(objectMap, "protectedFiles", c.ProtectedFiles) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "rootFile", c.RootFile) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationPackage. -func (c *ConfigurationPackage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationRequestProperties. +func (c *ConfigurationRequestProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -507,12 +607,21 @@ func (c *ConfigurationPackage) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "data": - err = unpopulate(val, "Data", &c.Data) + case "files": + err = unpopulate(val, "Files", &c.Files) + delete(rawMsg, key) + case "package": + err = unpopulate(val, "Package", &c.Package) delete(rawMsg, key) case "protectedFiles": err = unpopulate(val, "ProtectedFiles", &c.ProtectedFiles) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "rootFile": + err = unpopulate(val, "RootFile", &c.RootFile) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -521,8 +630,51 @@ func (c *ConfigurationPackage) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationProperties. -func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConfigurationResponse. +func (c ConfigurationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationResponse. +func (c *ConfigurationResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationResponseProperties. +func (c ConfigurationResponseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "files", c.Files) populate(objectMap, "package", c.Package) @@ -532,8 +684,8 @@ func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationProperties. -func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationResponseProperties. +func (c *ConfigurationResponseProperties) 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) @@ -623,6 +775,177 @@ func (d *Deployment) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeploymentAPIKeyListResponse. +func (d DeploymentAPIKeyListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentAPIKeyListResponse. +func (d *DeploymentAPIKeyListResponse) 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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + 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 DeploymentAPIKeyRequest. +func (d DeploymentAPIKeyRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentAPIKeyRequest. +func (d *DeploymentAPIKeyRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentAPIKeyRequestProperties. +func (d DeploymentAPIKeyRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endDateTime", d.EndDateTime) + populate(objectMap, "secretText", d.SecretText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentAPIKeyRequestProperties. +func (d *DeploymentAPIKeyRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &d.EndDateTime) + delete(rawMsg, key) + case "secretText": + err = unpopulate(val, "SecretText", &d.SecretText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentAPIKeyResponse. +func (d DeploymentAPIKeyResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentAPIKeyResponse. +func (d *DeploymentAPIKeyResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentAPIKeyResponseProperties. +func (d DeploymentAPIKeyResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endDateTime", d.EndDateTime) + populate(objectMap, "hint", d.Hint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentAPIKeyResponseProperties. +func (d *DeploymentAPIKeyResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &d.EndDateTime) + delete(rawMsg, key) + case "hint": + err = unpopulate(val, "Hint", &d.Hint) + 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 DeploymentListResponse. func (d DeploymentListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -658,11 +981,12 @@ func (d *DeploymentListResponse) UnmarshalJSON(data []byte) error { func (d DeploymentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoUpgradeProfile", d.AutoUpgradeProfile) + populate(objectMap, "dataplaneApiEndpoint", d.DataplaneAPIEndpoint) populate(objectMap, "enableDiagnosticsSupport", d.EnableDiagnosticsSupport) populate(objectMap, "ipAddress", d.IPAddress) populate(objectMap, "logging", d.Logging) - populate(objectMap, "managedResourceGroup", d.ManagedResourceGroup) populate(objectMap, "networkProfile", d.NetworkProfile) + populate(objectMap, "nginxAppProtect", d.NginxAppProtect) populate(objectMap, "nginxVersion", d.NginxVersion) populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "scalingProperties", d.ScalingProperties) @@ -682,6 +1006,9 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { case "autoUpgradeProfile": err = unpopulate(val, "AutoUpgradeProfile", &d.AutoUpgradeProfile) delete(rawMsg, key) + case "dataplaneApiEndpoint": + err = unpopulate(val, "DataplaneAPIEndpoint", &d.DataplaneAPIEndpoint) + delete(rawMsg, key) case "enableDiagnosticsSupport": err = unpopulate(val, "EnableDiagnosticsSupport", &d.EnableDiagnosticsSupport) delete(rawMsg, key) @@ -691,12 +1018,12 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { case "logging": err = unpopulate(val, "Logging", &d.Logging) delete(rawMsg, key) - case "managedResourceGroup": - err = unpopulate(val, "ManagedResourceGroup", &d.ManagedResourceGroup) - delete(rawMsg, key) case "networkProfile": err = unpopulate(val, "NetworkProfile", &d.NetworkProfile) delete(rawMsg, key) + case "nginxAppProtect": + err = unpopulate(val, "NginxAppProtect", &d.NginxAppProtect) + delete(rawMsg, key) case "nginxVersion": err = unpopulate(val, "NginxVersion", &d.NginxVersion) delete(rawMsg, key) @@ -717,6 +1044,37 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeploymentPropertiesNginxAppProtect. +func (d DeploymentPropertiesNginxAppProtect) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "webApplicationFirewallSettings", d.WebApplicationFirewallSettings) + populate(objectMap, "webApplicationFirewallStatus", d.WebApplicationFirewallStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPropertiesNginxAppProtect. +func (d *DeploymentPropertiesNginxAppProtect) 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 "webApplicationFirewallSettings": + err = unpopulate(val, "WebApplicationFirewallSettings", &d.WebApplicationFirewallSettings) + delete(rawMsg, key) + case "webApplicationFirewallStatus": + err = unpopulate(val, "WebApplicationFirewallStatus", &d.WebApplicationFirewallStatus) + 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 DeploymentScalingProperties. func (d DeploymentScalingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -824,6 +1182,8 @@ func (d DeploymentUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "autoUpgradeProfile", d.AutoUpgradeProfile) populate(objectMap, "enableDiagnosticsSupport", d.EnableDiagnosticsSupport) populate(objectMap, "logging", d.Logging) + populate(objectMap, "networkProfile", d.NetworkProfile) + populate(objectMap, "nginxAppProtect", d.NginxAppProtect) populate(objectMap, "scalingProperties", d.ScalingProperties) populate(objectMap, "userProfile", d.UserProfile) return json.Marshal(objectMap) @@ -847,6 +1207,12 @@ func (d *DeploymentUpdateProperties) UnmarshalJSON(data []byte) error { case "logging": err = unpopulate(val, "Logging", &d.Logging) delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &d.NetworkProfile) + delete(rawMsg, key) + case "nginxAppProtect": + err = unpopulate(val, "NginxAppProtect", &d.NginxAppProtect) + delete(rawMsg, key) case "scalingProperties": err = unpopulate(val, "ScalingProperties", &d.ScalingProperties) delete(rawMsg, key) @@ -861,6 +1227,33 @@ func (d *DeploymentUpdateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeploymentUpdatePropertiesNginxAppProtect. +func (d DeploymentUpdatePropertiesNginxAppProtect) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "webApplicationFirewallSettings", d.WebApplicationFirewallSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentUpdatePropertiesNginxAppProtect. +func (d *DeploymentUpdatePropertiesNginxAppProtect) 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 "webApplicationFirewallSettings": + err = unpopulate(val, "WebApplicationFirewallSettings", &d.WebApplicationFirewallSettings) + 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 DeploymentUserProfile. func (d DeploymentUserProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -888,6 +1281,65 @@ func (d *DeploymentUserProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DiagnosticItem. +func (d DiagnosticItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", d.Category) + populate(objectMap, "description", d.Description) + populate(objectMap, "directive", d.Directive) + populate(objectMap, "file", d.File) + populate(objectMap, "id", d.ID) + populate(objectMap, "level", d.Level) + populate(objectMap, "line", d.Line) + populate(objectMap, "message", d.Message) + populate(objectMap, "rule", d.Rule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticItem. +func (d *DiagnosticItem) 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 "category": + err = unpopulate(val, "Category", &d.Category) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "directive": + err = unpopulate(val, "Directive", &d.Directive) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &d.File) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &d.Level) + delete(rawMsg, key) + case "line": + err = unpopulate(val, "Line", &d.Line) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "rule": + err = unpopulate(val, "Rule", &d.Rule) + 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 FrontendIPConfiguration. func (f FrontendIPConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1408,6 +1860,134 @@ func (u *UserIdentityProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallComponentVersions. +func (w WebApplicationFirewallComponentVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "wafEngineVersion", w.WafEngineVersion) + populate(objectMap, "wafNginxVersion", w.WafNginxVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallComponentVersions. +func (w *WebApplicationFirewallComponentVersions) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "wafEngineVersion": + err = unpopulate(val, "WafEngineVersion", &w.WafEngineVersion) + delete(rawMsg, key) + case "wafNginxVersion": + err = unpopulate(val, "WafNginxVersion", &w.WafNginxVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallPackage. +func (w WebApplicationFirewallPackage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "revisionDatetime", w.RevisionDatetime) + populate(objectMap, "version", w.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallPackage. +func (w *WebApplicationFirewallPackage) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "revisionDatetime": + err = unpopulateDateTimeRFC3339(val, "RevisionDatetime", &w.RevisionDatetime) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &w.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallSettings. +func (w WebApplicationFirewallSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activationState", w.ActivationState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallSettings. +func (w *WebApplicationFirewallSettings) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activationState": + err = unpopulate(val, "ActivationState", &w.ActivationState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallStatus. +func (w WebApplicationFirewallStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attackSignaturesPackage", w.AttackSignaturesPackage) + populate(objectMap, "botSignaturesPackage", w.BotSignaturesPackage) + populate(objectMap, "componentVersions", w.ComponentVersions) + populate(objectMap, "threatCampaignsPackage", w.ThreatCampaignsPackage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallStatus. +func (w *WebApplicationFirewallStatus) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attackSignaturesPackage": + err = unpopulate(val, "AttackSignaturesPackage", &w.AttackSignaturesPackage) + delete(rawMsg, key) + case "botSignaturesPackage": + err = unpopulate(val, "BotSignaturesPackage", &w.BotSignaturesPackage) + delete(rawMsg, key) + case "componentVersions": + err = unpopulate(val, "ComponentVersions", &w.ComponentVersions) + delete(rawMsg, key) + case "threatCampaignsPackage": + err = unpopulate(val, "ThreatCampaignsPackage", &w.ThreatCampaignsPackage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/nginx/armnginx/operations_client.go b/sdk/resourcemanager/nginx/armnginx/operations_client.go index a74ba175f1d3..12421fb6b296 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 2024-01-01-preview api version. +// NewListPager - List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. // -// Generated from API version 2024-01-01-preview +// Generated from API version 2024-11-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", "2024-01-01-preview") + reqQP.Set("api-version", "2024-11-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 979b2a6634d4..a22fce17c805 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8d26b0e4c1886458fa56c22aac09c3e3e9a5c9e/specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/nginx/armnginx/options.go b/sdk/resourcemanager/nginx/armnginx/options.go index 91776fc61795..1050cf1dd817 100644 --- a/sdk/resourcemanager/nginx/armnginx/options.go +++ b/sdk/resourcemanager/nginx/armnginx/options.go @@ -8,6 +8,27 @@ package armnginx +// APIKeysClientCreateOrUpdateOptions contains the optional parameters for the APIKeysClient.CreateOrUpdate method. +type APIKeysClientCreateOrUpdateOptions struct { + // The API Key object containing fields (e.g. secret text, expiration date) to upsert the key. + Body *DeploymentAPIKeyRequest +} + +// APIKeysClientDeleteOptions contains the optional parameters for the APIKeysClient.Delete method. +type APIKeysClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// APIKeysClientGetOptions contains the optional parameters for the APIKeysClient.Get method. +type APIKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// APIKeysClientListOptions contains the optional parameters for the APIKeysClient.NewListPager method. +type APIKeysClientListOptions struct { + // placeholder for future optional parameters +} + // CertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.BeginCreateOrUpdate // method. type CertificatesClientBeginCreateOrUpdateOptions struct { @@ -44,7 +65,7 @@ type ConfigurationsClientAnalysisOptions struct { // method. type ConfigurationsClientBeginCreateOrUpdateOptions struct { // The NGINX configuration - Body *Configuration + Body *ConfigurationRequest // Resumes the LRO from the provided token. ResumeToken string diff --git a/sdk/resourcemanager/nginx/armnginx/responses.go b/sdk/resourcemanager/nginx/armnginx/responses.go index d10552acc9ab..2b411cd67eb2 100644 --- a/sdk/resourcemanager/nginx/armnginx/responses.go +++ b/sdk/resourcemanager/nginx/armnginx/responses.go @@ -8,6 +8,26 @@ package armnginx +// APIKeysClientCreateOrUpdateResponse contains the response from method APIKeysClient.CreateOrUpdate. +type APIKeysClientCreateOrUpdateResponse struct { + DeploymentAPIKeyResponse +} + +// APIKeysClientDeleteResponse contains the response from method APIKeysClient.Delete. +type APIKeysClientDeleteResponse struct { + // placeholder for future response values +} + +// APIKeysClientGetResponse contains the response from method APIKeysClient.Get. +type APIKeysClientGetResponse struct { + DeploymentAPIKeyResponse +} + +// APIKeysClientListResponse contains the response from method APIKeysClient.NewListPager. +type APIKeysClientListResponse struct { + DeploymentAPIKeyListResponse +} + // CertificatesClientCreateOrUpdateResponse contains the response from method CertificatesClient.BeginCreateOrUpdate. type CertificatesClientCreateOrUpdateResponse struct { Certificate @@ -36,7 +56,7 @@ type ConfigurationsClientAnalysisResponse struct { // ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.BeginCreateOrUpdate. type ConfigurationsClientCreateOrUpdateResponse struct { - Configuration + ConfigurationResponse } // ConfigurationsClientDeleteResponse contains the response from method ConfigurationsClient.BeginDelete. @@ -46,7 +66,7 @@ type ConfigurationsClientDeleteResponse struct { // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { - Configuration + ConfigurationResponse } // ConfigurationsClientListResponse contains the response from method ConfigurationsClient.NewListPager. From b491133abdb425be9e60e15ba7795bc8baa28629 Mon Sep 17 00:00:00 2001 From: jliusan Date: Fri, 21 Feb 2025 11:32:06 +0800 Subject: [PATCH 2/2] go mod tidy --- sdk/resourcemanager/nginx/armnginx/go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/resourcemanager/nginx/armnginx/go.sum b/sdk/resourcemanager/nginx/armnginx/go.sum index fd4413a8cf82..6324123af695 100644 --- a/sdk/resourcemanager/nginx/armnginx/go.sum +++ b/sdk/resourcemanager/nginx/armnginx/go.sum @@ -10,10 +10,12 @@ github.com/AzureAD/microsoft-authentication-library-for-go v1.4.0 h1:MUkXAnvvDHg github.com/AzureAD/microsoft-authentication-library-for-go v1.4.0/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=