From a3aee41efd8a4abe0b5b6621ad05f2eb71c67517 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 30 Aug 2022 08:27:54 +0000 Subject: [PATCH] CodeGen from PR 20429 in Azure/azure-rest-api-specs Merge 2654cd029d52f08b0eb7f59d849f0ff5a22db7bf into 62f0c6256ffda248e5d9bba61aae2102aa526eb7 --- sdk/resourcemanager/app/armapp/CHANGELOG.md | 9 + sdk/resourcemanager/app/armapp/LICENSE.txt | 21 + sdk/resourcemanager/app/armapp/README.md | 77 + sdk/resourcemanager/app/armapp/autorest.md | 13 + sdk/resourcemanager/app/armapp/build.go | 7 + .../app/armapp/certificates_client.go | 365 ++ sdk/resourcemanager/app/armapp/ci.yml | 28 + .../armapp/connectedenvironments_client.go | 480 ++ ...onnectedenvironmentscertificates_client.go | 369 ++ ...nectedenvironmentsdaprcomponents_client.go | 366 ++ .../connectedenvironmentsstorages_client.go | 291 + sdk/resourcemanager/app/armapp/constants.go | 511 ++ .../app/armapp/containerapps_client.go | 545 ++ .../armapp/containerappsauthconfigs_client.go | 304 + .../armapp/containerappsdiagnostics_client.go | 380 ++ .../containerappsrevisionreplicas_client.go | 185 + .../armapp/containerappsrevisions_client.go | 350 ++ .../containerappssourcecontrols_client.go | 325 + .../app/armapp/daprcomponents_client.go | 363 ++ sdk/resourcemanager/app/armapp/go.mod | 13 + sdk/resourcemanager/app/armapp/go.sum | 15 + .../managedenvironmentdiagnostics_client.go | 175 + .../app/armapp/managedenvironments_client.go | 428 ++ .../managedenvironmentsdiagnostics_client.go | 113 + .../managedenvironmentsstorages_client.go | 291 + sdk/resourcemanager/app/armapp/models.go | 2521 ++++++++ .../app/armapp/models_serde.go | 5403 +++++++++++++++++ .../app/armapp/namespaces_client.go | 114 + .../app/armapp/operations_client.go | 105 + .../app/armapp/response_types.go | 380 ++ .../app/armapp/time_rfc3339.go | 87 + 31 files changed, 14634 insertions(+) create mode 100644 sdk/resourcemanager/app/armapp/CHANGELOG.md create mode 100644 sdk/resourcemanager/app/armapp/LICENSE.txt create mode 100644 sdk/resourcemanager/app/armapp/README.md create mode 100644 sdk/resourcemanager/app/armapp/autorest.md create mode 100644 sdk/resourcemanager/app/armapp/build.go create mode 100644 sdk/resourcemanager/app/armapp/certificates_client.go create mode 100644 sdk/resourcemanager/app/armapp/ci.yml create mode 100644 sdk/resourcemanager/app/armapp/connectedenvironments_client.go create mode 100644 sdk/resourcemanager/app/armapp/connectedenvironmentscertificates_client.go create mode 100644 sdk/resourcemanager/app/armapp/connectedenvironmentsdaprcomponents_client.go create mode 100644 sdk/resourcemanager/app/armapp/connectedenvironmentsstorages_client.go create mode 100644 sdk/resourcemanager/app/armapp/constants.go create mode 100644 sdk/resourcemanager/app/armapp/containerapps_client.go create mode 100644 sdk/resourcemanager/app/armapp/containerappsauthconfigs_client.go create mode 100644 sdk/resourcemanager/app/armapp/containerappsdiagnostics_client.go create mode 100644 sdk/resourcemanager/app/armapp/containerappsrevisionreplicas_client.go create mode 100644 sdk/resourcemanager/app/armapp/containerappsrevisions_client.go create mode 100644 sdk/resourcemanager/app/armapp/containerappssourcecontrols_client.go create mode 100644 sdk/resourcemanager/app/armapp/daprcomponents_client.go create mode 100644 sdk/resourcemanager/app/armapp/go.mod create mode 100644 sdk/resourcemanager/app/armapp/go.sum create mode 100644 sdk/resourcemanager/app/armapp/managedenvironmentdiagnostics_client.go create mode 100644 sdk/resourcemanager/app/armapp/managedenvironments_client.go create mode 100644 sdk/resourcemanager/app/armapp/managedenvironmentsdiagnostics_client.go create mode 100644 sdk/resourcemanager/app/armapp/managedenvironmentsstorages_client.go create mode 100644 sdk/resourcemanager/app/armapp/models.go create mode 100644 sdk/resourcemanager/app/armapp/models_serde.go create mode 100644 sdk/resourcemanager/app/armapp/namespaces_client.go create mode 100644 sdk/resourcemanager/app/armapp/operations_client.go create mode 100644 sdk/resourcemanager/app/armapp/response_types.go create mode 100644 sdk/resourcemanager/app/armapp/time_rfc3339.go diff --git a/sdk/resourcemanager/app/armapp/CHANGELOG.md b/sdk/resourcemanager/app/armapp/CHANGELOG.md new file mode 100644 index 000000000000..66e7100bf62a --- /dev/null +++ b/sdk/resourcemanager/app/armapp/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 0.1.0 (2022-08-30) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/app/armapp` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.1.0, which contains breaking changes. + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/app/armapp/LICENSE.txt b/sdk/resourcemanager/app/armapp/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/app/armapp/README.md b/sdk/resourcemanager/app/armapp/README.md new file mode 100644 index 000000000000..3121e14f1705 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/README.md @@ -0,0 +1,77 @@ +# Azure App Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/app/armapp)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/app/armapp) + +The `armapp` module provides operations for working with Azure App. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/app/armapp) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.19 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure App module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/app/armapp +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure App. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure App modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client, err := armapp.NewContainerAppsDiagnosticsClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions{ + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +client, err := armapp.NewContainerAppsDiagnosticsClient(, cred, &options) +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `App` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/app/armapp/autorest.md b/sdk/resourcemanager/app/armapp/autorest.md new file mode 100644 index 000000000000..b50091f57333 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/app/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/app/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/app/armapp/build.go b/sdk/resourcemanager/app/armapp/build.go new file mode 100644 index 000000000000..7ff30f97b574 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/app/armapp + +package armapp diff --git a/sdk/resourcemanager/app/armapp/certificates_client.go b/sdk/resourcemanager/app/armapp/certificates_client.go new file mode 100644 index 000000000000..a53c509950db --- /dev/null +++ b/sdk/resourcemanager/app/armapp/certificates_client.go @@ -0,0 +1,365 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// CertificatesClient contains the methods for the Certificates group. +// Don't use this type directly, use NewCertificatesClient() instead. +type CertificatesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCertificatesClient creates a new instance of CertificatesClient with the specified values. +// subscriptionID - The ID of the target subscription. +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CertificatesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or Update a Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// certificateName - Name of the Certificate. +// options - CertificatesClientCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.CreateOrUpdate +// method. +func (client *CertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, certificateName string, options *CertificatesClientCreateOrUpdateOptions) (CertificatesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, certificateName, options) + if err != nil { + return CertificatesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CertificatesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificatesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, certificateName string, options *CertificatesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.CertificateEnvelope != nil { + return req, runtime.MarshalAsJSON(req, *options.CertificateEnvelope) + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *CertificatesClient) createOrUpdateHandleResponse(resp *http.Response) (CertificatesClientCreateOrUpdateResponse, error) { + result := CertificatesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return CertificatesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// certificateName - Name of the Certificate. +// options - CertificatesClientDeleteOptions contains the optional parameters for the CertificatesClient.Delete method. +func (client *CertificatesClient) Delete(ctx context.Context, resourceGroupName string, environmentName string, certificateName string, options *CertificatesClientDeleteOptions) (CertificatesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, certificateName, options) + if err != nil { + return CertificatesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CertificatesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return CertificatesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return CertificatesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, certificateName string, options *CertificatesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// certificateName - Name of the Certificate. +// options - CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. +func (client *CertificatesClient) Get(ctx context.Context, resourceGroupName string, environmentName string, certificateName string, options *CertificatesClientGetOptions) (CertificatesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, environmentName, certificateName, options) + if err != nil { + return CertificatesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CertificatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificatesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, certificateName string, options *CertificatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *CertificatesClient) getHandleResponse(resp *http.Response) (CertificatesClientGetResponse, error) { + result := CertificatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return CertificatesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Certificates in a given managed environment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// options - CertificatesClientListOptions contains the optional parameters for the CertificatesClient.List method. +func (client *CertificatesClient) NewListPager(resourceGroupName string, environmentName string, options *CertificatesClientListOptions) *runtime.Pager[CertificatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CertificatesClientListResponse]{ + More: func(page CertificatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CertificatesClientListResponse) (CertificatesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, environmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CertificatesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CertificatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *CertificatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *CertificatesClient) listHandleResponse(resp *http.Response) (CertificatesClientListResponse, error) { + result := CertificatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateCollection); err != nil { + return CertificatesClientListResponse{}, err + } + return result, nil +} + +// Update - Patches a certificate. Currently only patching of tags is supported +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// certificateName - Name of the Certificate. +// certificateEnvelope - Properties of a certificate that need to be updated +// options - CertificatesClientUpdateOptions contains the optional parameters for the CertificatesClient.Update method. +func (client *CertificatesClient) Update(ctx context.Context, resourceGroupName string, environmentName string, certificateName string, certificateEnvelope CertificatePatch, options *CertificatesClientUpdateOptions) (CertificatesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, environmentName, certificateName, certificateEnvelope, options) + if err != nil { + return CertificatesClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CertificatesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificatesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *CertificatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, certificateName string, certificateEnvelope CertificatePatch, options *CertificatesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, certificateEnvelope) +} + +// updateHandleResponse handles the Update response. +func (client *CertificatesClient) updateHandleResponse(resp *http.Response) (CertificatesClientUpdateResponse, error) { + result := CertificatesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return CertificatesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/ci.yml b/sdk/resourcemanager/app/armapp/ci.yml new file mode 100644 index 000000000000..a3bc545045b5 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/app/armapp/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/app/armapp/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/app/armapp' diff --git a/sdk/resourcemanager/app/armapp/connectedenvironments_client.go b/sdk/resourcemanager/app/armapp/connectedenvironments_client.go new file mode 100644 index 000000000000..ade34b490973 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/connectedenvironments_client.go @@ -0,0 +1,480 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectedEnvironmentsClient contains the methods for the ConnectedEnvironments group. +// Don't use this type directly, use NewConnectedEnvironmentsClient() instead. +type ConnectedEnvironmentsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectedEnvironmentsClient creates a new instance of ConnectedEnvironmentsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectedEnvironmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectedEnvironmentsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CheckNameAvailability - Checks if resource connectedEnvironmentName is available. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Managed Environment. +// checkNameAvailabilityRequest - The check connectedEnvironmentName availability request. +// options - ConnectedEnvironmentsClientCheckNameAvailabilityOptions contains the optional parameters for the ConnectedEnvironmentsClient.CheckNameAvailability +// method. +func (client *ConnectedEnvironmentsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ConnectedEnvironmentsClientCheckNameAvailabilityOptions) (ConnectedEnvironmentsClientCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, checkNameAvailabilityRequest, options) + if err != nil { + return ConnectedEnvironmentsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *ConnectedEnvironmentsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ConnectedEnvironmentsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *ConnectedEnvironmentsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientCheckNameAvailabilityResponse, error) { + result := ConnectedEnvironmentsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return ConnectedEnvironmentsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreateOrUpdate - Creates or updates an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connectedEnvironment. +// environmentEnvelope - Configuration details of the connectedEnvironment. +// options - ConnectedEnvironmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsClient.BeginCreateOrUpdate +// method. +func (client *ConnectedEnvironmentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, environmentEnvelope ConnectedEnvironment, options *ConnectedEnvironmentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConnectedEnvironmentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, connectedEnvironmentName, environmentEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ConnectedEnvironmentsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ConnectedEnvironmentsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ConnectedEnvironmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, environmentEnvelope ConnectedEnvironment, options *ConnectedEnvironmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, environmentEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectedEnvironmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, environmentEnvelope ConnectedEnvironment, options *ConnectedEnvironmentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, environmentEnvelope) +} + +// BeginDelete - Delete an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connectedEnvironment. +// options - ConnectedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsClient.BeginDelete +// method. +func (client *ConnectedEnvironmentsClient) BeginDelete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*runtime.Poller[ConnectedEnvironmentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ConnectedEnvironmentsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ConnectedEnvironmentsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ConnectedEnvironmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the properties of an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connectedEnvironment. +// options - ConnectedEnvironmentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsClient.Get +// method. +func (client *ConnectedEnvironmentsClient) Get(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientGetOptions) (ConnectedEnvironmentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return ConnectedEnvironmentsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectedEnvironmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ConnectedEnvironmentsClient) getHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientGetResponse, error) { + result := ConnectedEnvironmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironment); err != nil { + return ConnectedEnvironmentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all connectedEnvironments in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// options - ConnectedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ConnectedEnvironmentsClient.ListByResourceGroup +// method. +func (client *ConnectedEnvironmentsClient) NewListByResourceGroupPager(resourceGroupName string, options *ConnectedEnvironmentsClientListByResourceGroupOptions) *runtime.Pager[ConnectedEnvironmentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectedEnvironmentsClientListByResourceGroupResponse]{ + More: func(page ConnectedEnvironmentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectedEnvironmentsClientListByResourceGroupResponse) (ConnectedEnvironmentsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectedEnvironmentsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ConnectedEnvironmentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ConnectedEnvironmentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments" + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ConnectedEnvironmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientListByResourceGroupResponse, error) { + result := ConnectedEnvironmentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentCollection); err != nil { + return ConnectedEnvironmentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get all connectedEnvironments for a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// options - ConnectedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ConnectedEnvironmentsClient.ListBySubscription +// method. +func (client *ConnectedEnvironmentsClient) NewListBySubscriptionPager(options *ConnectedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ConnectedEnvironmentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectedEnvironmentsClientListBySubscriptionResponse]{ + More: func(page ConnectedEnvironmentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectedEnvironmentsClientListBySubscriptionResponse) (ConnectedEnvironmentsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectedEnvironmentsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ConnectedEnvironmentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ConnectedEnvironmentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ConnectedEnvironmentsClient) listBySubscriptionHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientListBySubscriptionResponse, error) { + result := ConnectedEnvironmentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentCollection); err != nil { + return ConnectedEnvironmentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Patches a Managed Environment. Only patching of tags is supported currently +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connectedEnvironment. +// options - ConnectedEnvironmentsClientUpdateOptions contains the optional parameters for the ConnectedEnvironmentsClient.Update +// method. +func (client *ConnectedEnvironmentsClient) Update(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientUpdateOptions) (ConnectedEnvironmentsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return ConnectedEnvironmentsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ConnectedEnvironmentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ConnectedEnvironmentsClient) updateHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientUpdateResponse, error) { + result := ConnectedEnvironmentsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironment); err != nil { + return ConnectedEnvironmentsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/connectedenvironmentscertificates_client.go b/sdk/resourcemanager/app/armapp/connectedenvironmentscertificates_client.go new file mode 100644 index 000000000000..1f197ae56254 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/connectedenvironmentscertificates_client.go @@ -0,0 +1,369 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectedEnvironmentsCertificatesClient contains the methods for the ConnectedEnvironmentsCertificates group. +// Don't use this type directly, use NewConnectedEnvironmentsCertificatesClient() instead. +type ConnectedEnvironmentsCertificatesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectedEnvironmentsCertificatesClient creates a new instance of ConnectedEnvironmentsCertificatesClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectedEnvironmentsCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsCertificatesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectedEnvironmentsCertificatesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or Update a Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Connected Environment. +// certificateName - Name of the Certificate. +// options - ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.CreateOrUpdate +// method. +func (client *ConnectedEnvironmentsCertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions) (ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) + if err != nil { + return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.CertificateEnvelope != nil { + return req, runtime.MarshalAsJSON(req, *options.CertificateEnvelope) + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse, error) { + result := ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Connected Environment. +// certificateName - Name of the Certificate. +// options - ConnectedEnvironmentsCertificatesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Delete +// method. +func (client *ConnectedEnvironmentsCertificatesClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientDeleteOptions) (ConnectedEnvironmentsCertificatesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) + if err != nil { + return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectedEnvironmentsCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Connected Environment. +// certificateName - Name of the Certificate. +// options - ConnectedEnvironmentsCertificatesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Get +// method. +func (client *ConnectedEnvironmentsCertificatesClient) Get(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientGetOptions) (ConnectedEnvironmentsCertificatesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) + if err != nil { + return ConnectedEnvironmentsCertificatesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsCertificatesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectedEnvironmentsCertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ConnectedEnvironmentsCertificatesClient) getHandleResponse(resp *http.Response) (ConnectedEnvironmentsCertificatesClientGetResponse, error) { + result := ConnectedEnvironmentsCertificatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return ConnectedEnvironmentsCertificatesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Certificates in a given connected environment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Connected Environment. +// options - ConnectedEnvironmentsCertificatesClientListOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.List +// method. +func (client *ConnectedEnvironmentsCertificatesClient) NewListPager(resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsCertificatesClientListOptions) *runtime.Pager[ConnectedEnvironmentsCertificatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectedEnvironmentsCertificatesClientListResponse]{ + More: func(page ConnectedEnvironmentsCertificatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectedEnvironmentsCertificatesClientListResponse) (ConnectedEnvironmentsCertificatesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectedEnvironmentsCertificatesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsCertificatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectedEnvironmentsCertificatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsCertificatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ConnectedEnvironmentsCertificatesClient) listHandleResponse(resp *http.Response) (ConnectedEnvironmentsCertificatesClientListResponse, error) { + result := ConnectedEnvironmentsCertificatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateCollection); err != nil { + return ConnectedEnvironmentsCertificatesClientListResponse{}, err + } + return result, nil +} + +// Update - Patches a certificate. Currently only patching of tags is supported +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Connected Environment. +// certificateName - Name of the Certificate. +// certificateEnvelope - Properties of a certificate that need to be updated +// options - ConnectedEnvironmentsCertificatesClientUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Update +// method. +func (client *ConnectedEnvironmentsCertificatesClient) Update(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope CertificatePatch, options *ConnectedEnvironmentsCertificatesClientUpdateOptions) (ConnectedEnvironmentsCertificatesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, certificateEnvelope, options) + if err != nil { + return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ConnectedEnvironmentsCertificatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope CertificatePatch, options *ConnectedEnvironmentsCertificatesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, certificateEnvelope) +} + +// updateHandleResponse handles the Update response. +func (client *ConnectedEnvironmentsCertificatesClient) updateHandleResponse(resp *http.Response) (ConnectedEnvironmentsCertificatesClientUpdateResponse, error) { + result := ConnectedEnvironmentsCertificatesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/connectedenvironmentsdaprcomponents_client.go b/sdk/resourcemanager/app/armapp/connectedenvironmentsdaprcomponents_client.go new file mode 100644 index 000000000000..b8801b1a00d2 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/connectedenvironmentsdaprcomponents_client.go @@ -0,0 +1,366 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectedEnvironmentsDaprComponentsClient contains the methods for the ConnectedEnvironmentsDaprComponents group. +// Don't use this type directly, use NewConnectedEnvironmentsDaprComponentsClient() instead. +type ConnectedEnvironmentsDaprComponentsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectedEnvironmentsDaprComponentsClient creates a new instance of ConnectedEnvironmentsDaprComponentsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectedEnvironmentsDaprComponentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsDaprComponentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectedEnvironmentsDaprComponentsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a Dapr Component in a connected environment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connected environment. +// componentName - Name of the Dapr Component. +// daprComponentEnvelope - Configuration details of the Dapr Component. +// options - ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope DaprComponent, options *ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions) (ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, daprComponentEnvelope, options) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope DaprComponent, options *ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, daprComponentEnvelope) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse, error) { + result := ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponent); err != nil { + return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Dapr Component from a connected environment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connected environment. +// componentName - Name of the Dapr Component. +// options - ConnectedEnvironmentsDaprComponentsClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Delete +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientDeleteOptions) (ConnectedEnvironmentsDaprComponentsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, options) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectedEnvironmentsDaprComponentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a dapr component. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connected environment. +// componentName - Name of the Dapr Component. +// options - ConnectedEnvironmentsDaprComponentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Get +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) Get(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientGetOptions) (ConnectedEnvironmentsDaprComponentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, options) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectedEnvironmentsDaprComponentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ConnectedEnvironmentsDaprComponentsClient) getHandleResponse(resp *http.Response) (ConnectedEnvironmentsDaprComponentsClientGetResponse, error) { + result := ConnectedEnvironmentsDaprComponentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponent); err != nil { + return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Dapr Components for a connected environment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connected environment. +// options - ConnectedEnvironmentsDaprComponentsClientListOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.List +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) NewListPager(resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsDaprComponentsClientListOptions) *runtime.Pager[ConnectedEnvironmentsDaprComponentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectedEnvironmentsDaprComponentsClientListResponse]{ + More: func(page ConnectedEnvironmentsDaprComponentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectedEnvironmentsDaprComponentsClientListResponse) (ConnectedEnvironmentsDaprComponentsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsDaprComponentsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectedEnvironmentsDaprComponentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsDaprComponentsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ConnectedEnvironmentsDaprComponentsClient) listHandleResponse(resp *http.Response) (ConnectedEnvironmentsDaprComponentsClientListResponse, error) { + result := ConnectedEnvironmentsDaprComponentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponentsCollection); err != nil { + return ConnectedEnvironmentsDaprComponentsClientListResponse{}, err + } + return result, nil +} + +// ListSecrets - List secrets for a dapr component +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the connected environment. +// componentName - Name of the Dapr Component. +// options - ConnectedEnvironmentsDaprComponentsClientListSecretsOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.ListSecrets +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) ListSecrets(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientListSecretsOptions) (ConnectedEnvironmentsDaprComponentsClientListSecretsResponse, error) { + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, options) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{}, runtime.NewResponseError(resp) + } + return client.listSecretsHandleResponse(resp) +} + +// listSecretsCreateRequest creates the ListSecrets request. +func (client *ConnectedEnvironmentsDaprComponentsClient) listSecretsCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecretsHandleResponse handles the ListSecrets response. +func (client *ConnectedEnvironmentsDaprComponentsClient) listSecretsHandleResponse(resp *http.Response) (ConnectedEnvironmentsDaprComponentsClientListSecretsResponse, error) { + result := ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprSecretsCollection); err != nil { + return ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/connectedenvironmentsstorages_client.go b/sdk/resourcemanager/app/armapp/connectedenvironmentsstorages_client.go new file mode 100644 index 000000000000..74c53e91a2be --- /dev/null +++ b/sdk/resourcemanager/app/armapp/connectedenvironmentsstorages_client.go @@ -0,0 +1,291 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectedEnvironmentsStoragesClient contains the methods for the ConnectedEnvironmentsStorages group. +// Don't use this type directly, use NewConnectedEnvironmentsStoragesClient() instead. +type ConnectedEnvironmentsStoragesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectedEnvironmentsStoragesClient creates a new instance of ConnectedEnvironmentsStoragesClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectedEnvironmentsStoragesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsStoragesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectedEnvironmentsStoragesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or update storage for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Environment. +// storageName - Name of the storage. +// storageEnvelope - Configuration details of storage. +// options - ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.CreateOrUpdate +// method. +func (client *ConnectedEnvironmentsStoragesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope ConnectedEnvironmentStorage, options *ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions) (ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, storageName, storageEnvelope, options) + if err != nil { + return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope ConnectedEnvironmentStorage, options *ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, storageEnvelope) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse, error) { + result := ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentStorage); err != nil { + return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete storage for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Environment. +// storageName - Name of the storage. +// options - ConnectedEnvironmentsStoragesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Delete +// method. +func (client *ConnectedEnvironmentsStoragesClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientDeleteOptions) (ConnectedEnvironmentsStoragesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, storageName, options) + if err != nil { + return ConnectedEnvironmentsStoragesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsStoragesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectedEnvironmentsStoragesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectedEnvironmentsStoragesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectedEnvironmentsStoragesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get storage for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Environment. +// storageName - Name of the storage. +// options - ConnectedEnvironmentsStoragesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Get +// method. +func (client *ConnectedEnvironmentsStoragesClient) Get(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientGetOptions) (ConnectedEnvironmentsStoragesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, storageName, options) + if err != nil { + return ConnectedEnvironmentsStoragesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsStoragesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsStoragesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectedEnvironmentsStoragesClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ConnectedEnvironmentsStoragesClient) getHandleResponse(resp *http.Response) (ConnectedEnvironmentsStoragesClientGetResponse, error) { + result := ConnectedEnvironmentsStoragesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentStorage); err != nil { + return ConnectedEnvironmentsStoragesClientGetResponse{}, err + } + return result, nil +} + +// List - Get all storages for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// connectedEnvironmentName - Name of the Environment. +// options - ConnectedEnvironmentsStoragesClientListOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.List +// method. +func (client *ConnectedEnvironmentsStoragesClient) List(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsStoragesClientListOptions) (ConnectedEnvironmentsStoragesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return ConnectedEnvironmentsStoragesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectedEnvironmentsStoragesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsStoragesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ConnectedEnvironmentsStoragesClient) listCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsStoragesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages" + 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 connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ConnectedEnvironmentsStoragesClient) listHandleResponse(resp *http.Response) (ConnectedEnvironmentsStoragesClientListResponse, error) { + result := ConnectedEnvironmentsStoragesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentStoragesCollection); err != nil { + return ConnectedEnvironmentsStoragesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/constants.go b/sdk/resourcemanager/app/armapp/constants.go new file mode 100644 index 000000000000..4ea3d1f03e4a --- /dev/null +++ b/sdk/resourcemanager/app/armapp/constants.go @@ -0,0 +1,511 @@ +//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 armapp + +const ( + moduleName = "armapp" + moduleVersion = "v0.1.0" +) + +// AccessMode - Access mode for storage +type AccessMode string + +const ( + AccessModeReadOnly AccessMode = "ReadOnly" + AccessModeReadWrite AccessMode = "ReadWrite" +) + +// PossibleAccessModeValues returns the possible values for the AccessMode const type. +func PossibleAccessModeValues() []AccessMode { + return []AccessMode{ + AccessModeReadOnly, + AccessModeReadWrite, + } +} + +// Action - Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of ALL Allow or ALL Deny +type Action string + +const ( + ActionAllow Action = "Allow" + ActionDeny Action = "Deny" +) + +// PossibleActionValues returns the possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{ + ActionAllow, + ActionDeny, + } +} + +// ActiveRevisionsMode - ActiveRevisionsMode controls how active revisions are handled for the Container app:Multiple: multiple +// revisions can be active.Single: Only one revision can be active at a time. Revision weights can +// not be used in this mode. If no value if provided, this is the default. +type ActiveRevisionsMode string + +const ( + ActiveRevisionsModeMultiple ActiveRevisionsMode = "Multiple" + ActiveRevisionsModeSingle ActiveRevisionsMode = "Single" +) + +// PossibleActiveRevisionsModeValues returns the possible values for the ActiveRevisionsMode const type. +func PossibleActiveRevisionsModeValues() []ActiveRevisionsMode { + return []ActiveRevisionsMode{ + ActiveRevisionsModeMultiple, + ActiveRevisionsModeSingle, + } +} + +// AppProtocol - Tells Dapr which protocol your application is using. Valid options are http and grpc. Default is http +type AppProtocol string + +const ( + AppProtocolGrpc AppProtocol = "grpc" + AppProtocolHTTP AppProtocol = "http" +) + +// PossibleAppProtocolValues returns the possible values for the AppProtocol const type. +func PossibleAppProtocolValues() []AppProtocol { + return []AppProtocol{ + AppProtocolGrpc, + AppProtocolHTTP, + } +} + +// BindingType - Custom Domain binding type. +type BindingType string + +const ( + BindingTypeDisabled BindingType = "Disabled" + BindingTypeSniEnabled BindingType = "SniEnabled" +) + +// PossibleBindingTypeValues returns the possible values for the BindingType const type. +func PossibleBindingTypeValues() []BindingType { + return []BindingType{ + BindingTypeDisabled, + BindingTypeSniEnabled, + } +} + +// CertificateProvisioningState - Provisioning state of the certificate. +type CertificateProvisioningState string + +const ( + CertificateProvisioningStateCanceled CertificateProvisioningState = "Canceled" + CertificateProvisioningStateDeleteFailed CertificateProvisioningState = "DeleteFailed" + CertificateProvisioningStateFailed CertificateProvisioningState = "Failed" + CertificateProvisioningStatePending CertificateProvisioningState = "Pending" + CertificateProvisioningStateSucceeded CertificateProvisioningState = "Succeeded" +) + +// PossibleCertificateProvisioningStateValues returns the possible values for the CertificateProvisioningState const type. +func PossibleCertificateProvisioningStateValues() []CertificateProvisioningState { + return []CertificateProvisioningState{ + CertificateProvisioningStateCanceled, + CertificateProvisioningStateDeleteFailed, + CertificateProvisioningStateFailed, + CertificateProvisioningStatePending, + CertificateProvisioningStateSucceeded, + } +} + +// CheckNameAvailabilityReason - The reason why the given name is not available. +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +// PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. +func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { + return []CheckNameAvailabilityReason{ + CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, + } +} + +// ConnectedEnvironmentProvisioningState - Provisioning state of the Kubernetes Environment. +type ConnectedEnvironmentProvisioningState string + +const ( + ConnectedEnvironmentProvisioningStateCanceled ConnectedEnvironmentProvisioningState = "Canceled" + ConnectedEnvironmentProvisioningStateFailed ConnectedEnvironmentProvisioningState = "Failed" + ConnectedEnvironmentProvisioningStateInfrastructureSetupComplete ConnectedEnvironmentProvisioningState = "InfrastructureSetupComplete" + ConnectedEnvironmentProvisioningStateInfrastructureSetupInProgress ConnectedEnvironmentProvisioningState = "InfrastructureSetupInProgress" + ConnectedEnvironmentProvisioningStateInitializationInProgress ConnectedEnvironmentProvisioningState = "InitializationInProgress" + ConnectedEnvironmentProvisioningStateScheduledForDelete ConnectedEnvironmentProvisioningState = "ScheduledForDelete" + ConnectedEnvironmentProvisioningStateSucceeded ConnectedEnvironmentProvisioningState = "Succeeded" + ConnectedEnvironmentProvisioningStateWaiting ConnectedEnvironmentProvisioningState = "Waiting" +) + +// PossibleConnectedEnvironmentProvisioningStateValues returns the possible values for the ConnectedEnvironmentProvisioningState const type. +func PossibleConnectedEnvironmentProvisioningStateValues() []ConnectedEnvironmentProvisioningState { + return []ConnectedEnvironmentProvisioningState{ + ConnectedEnvironmentProvisioningStateCanceled, + ConnectedEnvironmentProvisioningStateFailed, + ConnectedEnvironmentProvisioningStateInfrastructureSetupComplete, + ConnectedEnvironmentProvisioningStateInfrastructureSetupInProgress, + ConnectedEnvironmentProvisioningStateInitializationInProgress, + ConnectedEnvironmentProvisioningStateScheduledForDelete, + ConnectedEnvironmentProvisioningStateSucceeded, + ConnectedEnvironmentProvisioningStateWaiting, + } +} + +// ContainerAppProvisioningState - Provisioning state of the Container App. +type ContainerAppProvisioningState string + +const ( + ContainerAppProvisioningStateCanceled ContainerAppProvisioningState = "Canceled" + ContainerAppProvisioningStateDeleting ContainerAppProvisioningState = "Deleting" + ContainerAppProvisioningStateFailed ContainerAppProvisioningState = "Failed" + ContainerAppProvisioningStateInProgress ContainerAppProvisioningState = "InProgress" + ContainerAppProvisioningStateSucceeded ContainerAppProvisioningState = "Succeeded" +) + +// PossibleContainerAppProvisioningStateValues returns the possible values for the ContainerAppProvisioningState const type. +func PossibleContainerAppProvisioningStateValues() []ContainerAppProvisioningState { + return []ContainerAppProvisioningState{ + ContainerAppProvisioningStateCanceled, + ContainerAppProvisioningStateDeleting, + ContainerAppProvisioningStateFailed, + ContainerAppProvisioningStateInProgress, + ContainerAppProvisioningStateSucceeded, + } +} + +// CookieExpirationConvention - The convention used when determining the session cookie's expiration. +type CookieExpirationConvention string + +const ( + CookieExpirationConventionFixedTime CookieExpirationConvention = "FixedTime" + CookieExpirationConventionIdentityProviderDerived CookieExpirationConvention = "IdentityProviderDerived" +) + +// PossibleCookieExpirationConventionValues returns the possible values for the CookieExpirationConvention const type. +func PossibleCookieExpirationConventionValues() []CookieExpirationConvention { + return []CookieExpirationConvention{ + CookieExpirationConventionFixedTime, + CookieExpirationConventionIdentityProviderDerived, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// DNSVerificationTestResult - DNS verification test result. +type DNSVerificationTestResult string + +const ( + DNSVerificationTestResultPassed DNSVerificationTestResult = "Passed" + DNSVerificationTestResultFailed DNSVerificationTestResult = "Failed" + DNSVerificationTestResultSkipped DNSVerificationTestResult = "Skipped" +) + +// PossibleDNSVerificationTestResultValues returns the possible values for the DNSVerificationTestResult const type. +func PossibleDNSVerificationTestResultValues() []DNSVerificationTestResult { + return []DNSVerificationTestResult{ + DNSVerificationTestResultPassed, + DNSVerificationTestResultFailed, + DNSVerificationTestResultSkipped, + } +} + +// EnvironmentProvisioningState - Provisioning state of the Environment. +type EnvironmentProvisioningState string + +const ( + EnvironmentProvisioningStateCanceled EnvironmentProvisioningState = "Canceled" + EnvironmentProvisioningStateFailed EnvironmentProvisioningState = "Failed" + EnvironmentProvisioningStateInfrastructureSetupComplete EnvironmentProvisioningState = "InfrastructureSetupComplete" + EnvironmentProvisioningStateInfrastructureSetupInProgress EnvironmentProvisioningState = "InfrastructureSetupInProgress" + EnvironmentProvisioningStateInitializationInProgress EnvironmentProvisioningState = "InitializationInProgress" + EnvironmentProvisioningStateScheduledForDelete EnvironmentProvisioningState = "ScheduledForDelete" + EnvironmentProvisioningStateSucceeded EnvironmentProvisioningState = "Succeeded" + EnvironmentProvisioningStateUpgradeFailed EnvironmentProvisioningState = "UpgradeFailed" + EnvironmentProvisioningStateUpgradeRequested EnvironmentProvisioningState = "UpgradeRequested" + EnvironmentProvisioningStateWaiting EnvironmentProvisioningState = "Waiting" +) + +// PossibleEnvironmentProvisioningStateValues returns the possible values for the EnvironmentProvisioningState const type. +func PossibleEnvironmentProvisioningStateValues() []EnvironmentProvisioningState { + return []EnvironmentProvisioningState{ + EnvironmentProvisioningStateCanceled, + EnvironmentProvisioningStateFailed, + EnvironmentProvisioningStateInfrastructureSetupComplete, + EnvironmentProvisioningStateInfrastructureSetupInProgress, + EnvironmentProvisioningStateInitializationInProgress, + EnvironmentProvisioningStateScheduledForDelete, + EnvironmentProvisioningStateSucceeded, + EnvironmentProvisioningStateUpgradeFailed, + EnvironmentProvisioningStateUpgradeRequested, + EnvironmentProvisioningStateWaiting, + } +} + +// ExtendedLocationTypes - The type of extendedLocation. +type ExtendedLocationTypes string + +const ( + ExtendedLocationTypesCustomLocation ExtendedLocationTypes = "CustomLocation" +) + +// PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ + ExtendedLocationTypesCustomLocation, + } +} + +// ForwardProxyConvention - The convention used to determine the url of the request made. +type ForwardProxyConvention string + +const ( + ForwardProxyConventionNoProxy ForwardProxyConvention = "NoProxy" + ForwardProxyConventionStandard ForwardProxyConvention = "Standard" + ForwardProxyConventionCustom ForwardProxyConvention = "Custom" +) + +// PossibleForwardProxyConventionValues returns the possible values for the ForwardProxyConvention const type. +func PossibleForwardProxyConventionValues() []ForwardProxyConvention { + return []ForwardProxyConvention{ + ForwardProxyConventionNoProxy, + ForwardProxyConventionStandard, + ForwardProxyConventionCustom, + } +} + +// IngressTransportMethod - Ingress transport protocol +type IngressTransportMethod string + +const ( + IngressTransportMethodAuto IngressTransportMethod = "auto" + IngressTransportMethodHTTP IngressTransportMethod = "http" + IngressTransportMethodHTTP2 IngressTransportMethod = "http2" + IngressTransportMethodTCP IngressTransportMethod = "tcp" +) + +// PossibleIngressTransportMethodValues returns the possible values for the IngressTransportMethod const type. +func PossibleIngressTransportMethodValues() []IngressTransportMethod { + return []IngressTransportMethod{ + IngressTransportMethodAuto, + IngressTransportMethodHTTP, + IngressTransportMethodHTTP2, + IngressTransportMethodTCP, + } +} + +// LogLevel - Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. +type LogLevel string + +const ( + LogLevelDebug LogLevel = "debug" + LogLevelError LogLevel = "error" + LogLevelInfo LogLevel = "info" + LogLevelWarn LogLevel = "warn" +) + +// PossibleLogLevelValues returns the possible values for the LogLevel const type. +func PossibleLogLevelValues() []LogLevel { + return []LogLevel{ + LogLevelDebug, + LogLevelError, + LogLevelInfo, + LogLevelWarn, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + +// RevisionHealthState - Current health State of the revision +type RevisionHealthState string + +const ( + RevisionHealthStateHealthy RevisionHealthState = "Healthy" + RevisionHealthStateNone RevisionHealthState = "None" + RevisionHealthStateUnhealthy RevisionHealthState = "Unhealthy" +) + +// PossibleRevisionHealthStateValues returns the possible values for the RevisionHealthState const type. +func PossibleRevisionHealthStateValues() []RevisionHealthState { + return []RevisionHealthState{ + RevisionHealthStateHealthy, + RevisionHealthStateNone, + RevisionHealthStateUnhealthy, + } +} + +// RevisionProvisioningState - Current provisioning State of the revision +type RevisionProvisioningState string + +const ( + RevisionProvisioningStateDeprovisioned RevisionProvisioningState = "Deprovisioned" + RevisionProvisioningStateDeprovisioning RevisionProvisioningState = "Deprovisioning" + RevisionProvisioningStateFailed RevisionProvisioningState = "Failed" + RevisionProvisioningStateProvisioned RevisionProvisioningState = "Provisioned" + RevisionProvisioningStateProvisioning RevisionProvisioningState = "Provisioning" +) + +// PossibleRevisionProvisioningStateValues returns the possible values for the RevisionProvisioningState const type. +func PossibleRevisionProvisioningStateValues() []RevisionProvisioningState { + return []RevisionProvisioningState{ + RevisionProvisioningStateDeprovisioned, + RevisionProvisioningStateDeprovisioning, + RevisionProvisioningStateFailed, + RevisionProvisioningStateProvisioned, + RevisionProvisioningStateProvisioning, + } +} + +// SKUName - Name of the Sku. +type SKUName string + +const ( + // SKUNameConsumption - Consumption SKU of Managed Environment. + SKUNameConsumption SKUName = "Consumption" + // SKUNamePremium - Premium SKU of Managed Environment. + SKUNamePremium SKUName = "Premium" +) + +// PossibleSKUNameValues returns the possible values for the SKUName const type. +func PossibleSKUNameValues() []SKUName { + return []SKUName{ + SKUNameConsumption, + SKUNamePremium, + } +} + +// Scheme - Scheme to use for connecting to the host. Defaults to HTTP. +type Scheme string + +const ( + SchemeHTTP Scheme = "HTTP" + SchemeHTTPS Scheme = "HTTPS" +) + +// PossibleSchemeValues returns the possible values for the Scheme const type. +func PossibleSchemeValues() []Scheme { + return []Scheme{ + SchemeHTTP, + SchemeHTTPS, + } +} + +// SourceControlOperationState - Current provisioning State of the operation +type SourceControlOperationState string + +const ( + SourceControlOperationStateCanceled SourceControlOperationState = "Canceled" + SourceControlOperationStateFailed SourceControlOperationState = "Failed" + SourceControlOperationStateInProgress SourceControlOperationState = "InProgress" + SourceControlOperationStateSucceeded SourceControlOperationState = "Succeeded" +) + +// PossibleSourceControlOperationStateValues returns the possible values for the SourceControlOperationState const type. +func PossibleSourceControlOperationStateValues() []SourceControlOperationState { + return []SourceControlOperationState{ + SourceControlOperationStateCanceled, + SourceControlOperationStateFailed, + SourceControlOperationStateInProgress, + SourceControlOperationStateSucceeded, + } +} + +// StorageType - Storage type for the volume. If not provided, use EmptyDir. +type StorageType string + +const ( + StorageTypeAzureFile StorageType = "AzureFile" + StorageTypeEmptyDir StorageType = "EmptyDir" +) + +// PossibleStorageTypeValues returns the possible values for the StorageType const type. +func PossibleStorageTypeValues() []StorageType { + return []StorageType{ + StorageTypeAzureFile, + StorageTypeEmptyDir, + } +} + +// Type - The type of probe. +type Type string + +const ( + TypeLiveness Type = "Liveness" + TypeReadiness Type = "Readiness" + TypeStartup Type = "Startup" +) + +// PossibleTypeValues returns the possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{ + TypeLiveness, + TypeReadiness, + TypeStartup, + } +} + +// UnauthenticatedClientActionV2 - The action to take when an unauthenticated client attempts to access the app. +type UnauthenticatedClientActionV2 string + +const ( + UnauthenticatedClientActionV2RedirectToLoginPage UnauthenticatedClientActionV2 = "RedirectToLoginPage" + UnauthenticatedClientActionV2AllowAnonymous UnauthenticatedClientActionV2 = "AllowAnonymous" + UnauthenticatedClientActionV2Return401 UnauthenticatedClientActionV2 = "Return401" + UnauthenticatedClientActionV2Return403 UnauthenticatedClientActionV2 = "Return403" +) + +// PossibleUnauthenticatedClientActionV2Values returns the possible values for the UnauthenticatedClientActionV2 const type. +func PossibleUnauthenticatedClientActionV2Values() []UnauthenticatedClientActionV2 { + return []UnauthenticatedClientActionV2{ + UnauthenticatedClientActionV2RedirectToLoginPage, + UnauthenticatedClientActionV2AllowAnonymous, + UnauthenticatedClientActionV2Return401, + UnauthenticatedClientActionV2Return403, + } +} diff --git a/sdk/resourcemanager/app/armapp/containerapps_client.go b/sdk/resourcemanager/app/armapp/containerapps_client.go new file mode 100644 index 000000000000..99c91c8921cd --- /dev/null +++ b/sdk/resourcemanager/app/armapp/containerapps_client.go @@ -0,0 +1,545 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ContainerAppsClient contains the methods for the ContainerApps group. +// Don't use this type directly, use NewContainerAppsClient() instead. +type ContainerAppsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewContainerAppsClient creates a new instance of ContainerAppsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewContainerAppsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ContainerAppsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// containerAppEnvelope - Properties used to create a container app +// options - ContainerAppsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerAppsClient.BeginCreateOrUpdate +// method. +func (client *ContainerAppsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ContainerAppsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, containerAppName, containerAppEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ContainerAppsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ContainerAppsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ContainerAppsClient) createOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, containerAppName, containerAppEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ContainerAppsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, containerAppEnvelope) +} + +// BeginDelete - Delete a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// options - ContainerAppsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsClient.BeginDelete +// method. +func (client *ContainerAppsClient) BeginDelete(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientBeginDeleteOptions) (*runtime.Poller[ContainerAppsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, containerAppName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ContainerAppsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ContainerAppsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ContainerAppsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, containerAppName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContainerAppsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the properties of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// options - ContainerAppsClientGetOptions contains the optional parameters for the ContainerAppsClient.Get method. +func (client *ContainerAppsClient) Get(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientGetOptions) (ContainerAppsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, containerAppName, options) + if err != nil { + return ContainerAppsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ContainerAppsClient) getCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ContainerAppsClient) getHandleResponse(resp *http.Response) (ContainerAppsClientGetResponse, error) { + result := ContainerAppsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerApp); err != nil { + return ContainerAppsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get the Container Apps in a given resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// options - ContainerAppsClientListByResourceGroupOptions contains the optional parameters for the ContainerAppsClient.ListByResourceGroup +// method. +func (client *ContainerAppsClient) NewListByResourceGroupPager(resourceGroupName string, options *ContainerAppsClientListByResourceGroupOptions) *runtime.Pager[ContainerAppsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsClientListByResourceGroupResponse]{ + More: func(page ContainerAppsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsClientListByResourceGroupResponse) (ContainerAppsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ContainerAppsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ContainerAppsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps" + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ContainerAppsClient) listByResourceGroupHandleResponse(resp *http.Response) (ContainerAppsClientListByResourceGroupResponse, error) { + result := ContainerAppsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerAppCollection); err != nil { + return ContainerAppsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get the Container Apps in a given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// options - ContainerAppsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsClient.ListBySubscription +// method. +func (client *ContainerAppsClient) NewListBySubscriptionPager(options *ContainerAppsClientListBySubscriptionOptions) *runtime.Pager[ContainerAppsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsClientListBySubscriptionResponse]{ + More: func(page ContainerAppsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsClientListBySubscriptionResponse) (ContainerAppsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ContainerAppsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ContainerAppsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ContainerAppsClient) listBySubscriptionHandleResponse(resp *http.Response) (ContainerAppsClientListBySubscriptionResponse, error) { + result := ContainerAppsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerAppCollection); err != nil { + return ContainerAppsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// ListCustomHostNameAnalysis - Analyzes a custom hostname for a Container App +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// options - ContainerAppsClientListCustomHostNameAnalysisOptions contains the optional parameters for the ContainerAppsClient.ListCustomHostNameAnalysis +// method. +func (client *ContainerAppsClient) ListCustomHostNameAnalysis(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientListCustomHostNameAnalysisOptions) (ContainerAppsClientListCustomHostNameAnalysisResponse, error) { + req, err := client.listCustomHostNameAnalysisCreateRequest(ctx, resourceGroupName, containerAppName, options) + if err != nil { + return ContainerAppsClientListCustomHostNameAnalysisResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsClientListCustomHostNameAnalysisResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsClientListCustomHostNameAnalysisResponse{}, runtime.NewResponseError(resp) + } + return client.listCustomHostNameAnalysisHandleResponse(resp) +} + +// listCustomHostNameAnalysisCreateRequest creates the ListCustomHostNameAnalysis request. +func (client *ContainerAppsClient) listCustomHostNameAnalysisCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientListCustomHostNameAnalysisOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.CustomHostname != nil { + reqQP.Set("customHostname", *options.CustomHostname) + } + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCustomHostNameAnalysisHandleResponse handles the ListCustomHostNameAnalysis response. +func (client *ContainerAppsClient) listCustomHostNameAnalysisHandleResponse(resp *http.Response) (ContainerAppsClientListCustomHostNameAnalysisResponse, error) { + result := ContainerAppsClientListCustomHostNameAnalysisResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomHostnameAnalysisResult); err != nil { + return ContainerAppsClientListCustomHostNameAnalysisResponse{}, err + } + return result, nil +} + +// ListSecrets - List secrets for a container app +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// options - ContainerAppsClientListSecretsOptions contains the optional parameters for the ContainerAppsClient.ListSecrets +// method. +func (client *ContainerAppsClient) ListSecrets(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientListSecretsOptions) (ContainerAppsClientListSecretsResponse, error) { + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, containerAppName, options) + if err != nil { + return ContainerAppsClientListSecretsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsClientListSecretsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsClientListSecretsResponse{}, runtime.NewResponseError(resp) + } + return client.listSecretsHandleResponse(resp) +} + +// listSecretsCreateRequest creates the ListSecrets request. +func (client *ContainerAppsClient) listSecretsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecretsHandleResponse handles the ListSecrets response. +func (client *ContainerAppsClient) listSecretsHandleResponse(resp *http.Response) (ContainerAppsClientListSecretsResponse, error) { + result := ContainerAppsClientListSecretsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecretsCollection); err != nil { + return ContainerAppsClientListSecretsResponse{}, err + } + return result, nil +} + +// BeginUpdate - Patches a Container App using JSON Merge Patch +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// containerAppEnvelope - Properties of a Container App that need to be updated +// options - ContainerAppsClientBeginUpdateOptions contains the optional parameters for the ContainerAppsClient.BeginUpdate +// method. +func (client *ContainerAppsClient) BeginUpdate(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginUpdateOptions) (*runtime.Poller[ContainerAppsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, containerAppName, containerAppEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ContainerAppsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ContainerAppsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Patches a Container App using JSON Merge Patch +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ContainerAppsClient) update(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, containerAppName, containerAppEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ContainerAppsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, containerAppEnvelope) +} diff --git a/sdk/resourcemanager/app/armapp/containerappsauthconfigs_client.go b/sdk/resourcemanager/app/armapp/containerappsauthconfigs_client.go new file mode 100644 index 000000000000..66a9c89a8cc4 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/containerappsauthconfigs_client.go @@ -0,0 +1,304 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ContainerAppsAuthConfigsClient contains the methods for the ContainerAppsAuthConfigs group. +// Don't use this type directly, use NewContainerAppsAuthConfigsClient() instead. +type ContainerAppsAuthConfigsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewContainerAppsAuthConfigsClient creates a new instance of ContainerAppsAuthConfigsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewContainerAppsAuthConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsAuthConfigsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ContainerAppsAuthConfigsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or update the AuthConfig for a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// authConfigName - Name of the Container App AuthConfig. +// authConfigEnvelope - Properties used to create a Container App AuthConfig +// options - ContainerAppsAuthConfigsClientCreateOrUpdateOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.CreateOrUpdate +// method. +func (client *ContainerAppsAuthConfigsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, authConfigName string, authConfigEnvelope AuthConfig, options *ContainerAppsAuthConfigsClientCreateOrUpdateOptions) (ContainerAppsAuthConfigsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, containerAppName, authConfigName, authConfigEnvelope, options) + if err != nil { + return ContainerAppsAuthConfigsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsAuthConfigsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsAuthConfigsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ContainerAppsAuthConfigsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, authConfigName string, authConfigEnvelope AuthConfig, options *ContainerAppsAuthConfigsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if authConfigName == "" { + return nil, errors.New("parameter authConfigName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authConfigName}", url.PathEscape(authConfigName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, authConfigEnvelope) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ContainerAppsAuthConfigsClient) createOrUpdateHandleResponse(resp *http.Response) (ContainerAppsAuthConfigsClientCreateOrUpdateResponse, error) { + result := ContainerAppsAuthConfigsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthConfig); err != nil { + return ContainerAppsAuthConfigsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Container App AuthConfig. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// authConfigName - Name of the Container App AuthConfig. +// options - ContainerAppsAuthConfigsClientDeleteOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.Delete +// method. +func (client *ContainerAppsAuthConfigsClient) Delete(ctx context.Context, resourceGroupName string, containerAppName string, authConfigName string, options *ContainerAppsAuthConfigsClientDeleteOptions) (ContainerAppsAuthConfigsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, containerAppName, authConfigName, options) + if err != nil { + return ContainerAppsAuthConfigsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsAuthConfigsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ContainerAppsAuthConfigsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ContainerAppsAuthConfigsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContainerAppsAuthConfigsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, authConfigName string, options *ContainerAppsAuthConfigsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if authConfigName == "" { + return nil, errors.New("parameter authConfigName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authConfigName}", url.PathEscape(authConfigName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a AuthConfig of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// authConfigName - Name of the Container App AuthConfig. +// options - ContainerAppsAuthConfigsClientGetOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.Get +// method. +func (client *ContainerAppsAuthConfigsClient) Get(ctx context.Context, resourceGroupName string, containerAppName string, authConfigName string, options *ContainerAppsAuthConfigsClientGetOptions) (ContainerAppsAuthConfigsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, containerAppName, authConfigName, options) + if err != nil { + return ContainerAppsAuthConfigsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsAuthConfigsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsAuthConfigsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ContainerAppsAuthConfigsClient) getCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, authConfigName string, options *ContainerAppsAuthConfigsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if authConfigName == "" { + return nil, errors.New("parameter authConfigName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authConfigName}", url.PathEscape(authConfigName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ContainerAppsAuthConfigsClient) getHandleResponse(resp *http.Response) (ContainerAppsAuthConfigsClientGetResponse, error) { + result := ContainerAppsAuthConfigsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthConfig); err != nil { + return ContainerAppsAuthConfigsClientGetResponse{}, err + } + return result, nil +} + +// NewListByContainerAppPager - Get the Container App AuthConfigs in a given resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// options - ContainerAppsAuthConfigsClientListByContainerAppOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.ListByContainerApp +// method. +func (client *ContainerAppsAuthConfigsClient) NewListByContainerAppPager(resourceGroupName string, containerAppName string, options *ContainerAppsAuthConfigsClientListByContainerAppOptions) *runtime.Pager[ContainerAppsAuthConfigsClientListByContainerAppResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsAuthConfigsClientListByContainerAppResponse]{ + More: func(page ContainerAppsAuthConfigsClientListByContainerAppResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsAuthConfigsClientListByContainerAppResponse) (ContainerAppsAuthConfigsClientListByContainerAppResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByContainerAppCreateRequest(ctx, resourceGroupName, containerAppName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsAuthConfigsClientListByContainerAppResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsAuthConfigsClientListByContainerAppResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsAuthConfigsClientListByContainerAppResponse{}, runtime.NewResponseError(resp) + } + return client.listByContainerAppHandleResponse(resp) + }, + }) +} + +// listByContainerAppCreateRequest creates the ListByContainerApp request. +func (client *ContainerAppsAuthConfigsClient) listByContainerAppCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsAuthConfigsClientListByContainerAppOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByContainerAppHandleResponse handles the ListByContainerApp response. +func (client *ContainerAppsAuthConfigsClient) listByContainerAppHandleResponse(resp *http.Response) (ContainerAppsAuthConfigsClientListByContainerAppResponse, error) { + result := ContainerAppsAuthConfigsClientListByContainerAppResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthConfigCollection); err != nil { + return ContainerAppsAuthConfigsClientListByContainerAppResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/containerappsdiagnostics_client.go b/sdk/resourcemanager/app/armapp/containerappsdiagnostics_client.go new file mode 100644 index 000000000000..f80daba5b3ea --- /dev/null +++ b/sdk/resourcemanager/app/armapp/containerappsdiagnostics_client.go @@ -0,0 +1,380 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ContainerAppsDiagnosticsClient contains the methods for the ContainerAppsDiagnostics group. +// Don't use this type directly, use NewContainerAppsDiagnosticsClient() instead. +type ContainerAppsDiagnosticsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewContainerAppsDiagnosticsClient creates a new instance of ContainerAppsDiagnosticsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewContainerAppsDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsDiagnosticsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ContainerAppsDiagnosticsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// GetDetector - Get a diagnostics result of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// detectorName - Name of the Container App Detector. +// options - ContainerAppsDiagnosticsClientGetDetectorOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetDetector +// method. +func (client *ContainerAppsDiagnosticsClient) GetDetector(ctx context.Context, resourceGroupName string, containerAppName string, detectorName string, options *ContainerAppsDiagnosticsClientGetDetectorOptions) (ContainerAppsDiagnosticsClientGetDetectorResponse, error) { + req, err := client.getDetectorCreateRequest(ctx, resourceGroupName, containerAppName, detectorName, options) + if err != nil { + return ContainerAppsDiagnosticsClientGetDetectorResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientGetDetectorResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientGetDetectorResponse{}, runtime.NewResponseError(resp) + } + return client.getDetectorHandleResponse(resp) +} + +// getDetectorCreateRequest creates the GetDetector request. +func (client *ContainerAppsDiagnosticsClient) getDetectorCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, detectorName string, options *ContainerAppsDiagnosticsClientGetDetectorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if detectorName == "" { + return nil, errors.New("parameter detectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{detectorName}", url.PathEscape(detectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDetectorHandleResponse handles the GetDetector response. +func (client *ContainerAppsDiagnosticsClient) getDetectorHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientGetDetectorResponse, error) { + result := ContainerAppsDiagnosticsClientGetDetectorResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Diagnostics); err != nil { + return ContainerAppsDiagnosticsClientGetDetectorResponse{}, err + } + return result, nil +} + +// GetRevision - Get a revision of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// revisionName - Name of the Container App Revision. +// options - ContainerAppsDiagnosticsClientGetRevisionOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetRevision +// method. +func (client *ContainerAppsDiagnosticsClient) GetRevision(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsDiagnosticsClientGetRevisionOptions) (ContainerAppsDiagnosticsClientGetRevisionResponse, error) { + req, err := client.getRevisionCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, options) + if err != nil { + return ContainerAppsDiagnosticsClientGetRevisionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientGetRevisionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientGetRevisionResponse{}, runtime.NewResponseError(resp) + } + return client.getRevisionHandleResponse(resp) +} + +// getRevisionCreateRequest creates the GetRevision request. +func (client *ContainerAppsDiagnosticsClient) getRevisionCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsDiagnosticsClientGetRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getRevisionHandleResponse handles the GetRevision response. +func (client *ContainerAppsDiagnosticsClient) getRevisionHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientGetRevisionResponse, error) { + result := ContainerAppsDiagnosticsClientGetRevisionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Revision); err != nil { + return ContainerAppsDiagnosticsClientGetRevisionResponse{}, err + } + return result, nil +} + +// GetRoot - Get the properties of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// options - ContainerAppsDiagnosticsClientGetRootOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetRoot +// method. +func (client *ContainerAppsDiagnosticsClient) GetRoot(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientGetRootOptions) (ContainerAppsDiagnosticsClientGetRootResponse, error) { + req, err := client.getRootCreateRequest(ctx, resourceGroupName, containerAppName, options) + if err != nil { + return ContainerAppsDiagnosticsClientGetRootResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientGetRootResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientGetRootResponse{}, runtime.NewResponseError(resp) + } + return client.getRootHandleResponse(resp) +} + +// getRootCreateRequest creates the GetRoot request. +func (client *ContainerAppsDiagnosticsClient) getRootCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientGetRootOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getRootHandleResponse handles the GetRoot response. +func (client *ContainerAppsDiagnosticsClient) getRootHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientGetRootResponse, error) { + result := ContainerAppsDiagnosticsClientGetRootResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerApp); err != nil { + return ContainerAppsDiagnosticsClientGetRootResponse{}, err + } + return result, nil +} + +// NewListDetectorsPager - Get the list of diagnostics for a given Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App for which detector info is needed. +// options - ContainerAppsDiagnosticsClientListDetectorsOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.ListDetectors +// method. +func (client *ContainerAppsDiagnosticsClient) NewListDetectorsPager(resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientListDetectorsOptions) *runtime.Pager[ContainerAppsDiagnosticsClientListDetectorsResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsDiagnosticsClientListDetectorsResponse]{ + More: func(page ContainerAppsDiagnosticsClientListDetectorsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsDiagnosticsClientListDetectorsResponse) (ContainerAppsDiagnosticsClientListDetectorsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listDetectorsCreateRequest(ctx, resourceGroupName, containerAppName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsDiagnosticsClientListDetectorsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientListDetectorsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientListDetectorsResponse{}, runtime.NewResponseError(resp) + } + return client.listDetectorsHandleResponse(resp) + }, + }) +} + +// listDetectorsCreateRequest creates the ListDetectors request. +func (client *ContainerAppsDiagnosticsClient) listDetectorsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientListDetectorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listDetectorsHandleResponse handles the ListDetectors response. +func (client *ContainerAppsDiagnosticsClient) listDetectorsHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientListDetectorsResponse, error) { + result := ContainerAppsDiagnosticsClientListDetectorsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticsCollection); err != nil { + return ContainerAppsDiagnosticsClientListDetectorsResponse{}, err + } + return result, nil +} + +// NewListRevisionsPager - Get the Revisions for a given Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App for which Revisions are needed. +// options - ContainerAppsDiagnosticsClientListRevisionsOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.ListRevisions +// method. +func (client *ContainerAppsDiagnosticsClient) NewListRevisionsPager(resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientListRevisionsOptions) *runtime.Pager[ContainerAppsDiagnosticsClientListRevisionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsDiagnosticsClientListRevisionsResponse]{ + More: func(page ContainerAppsDiagnosticsClientListRevisionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsDiagnosticsClientListRevisionsResponse) (ContainerAppsDiagnosticsClientListRevisionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listRevisionsCreateRequest(ctx, resourceGroupName, containerAppName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsDiagnosticsClientListRevisionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientListRevisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientListRevisionsResponse{}, runtime.NewResponseError(resp) + } + return client.listRevisionsHandleResponse(resp) + }, + }) +} + +// listRevisionsCreateRequest creates the ListRevisions request. +func (client *ContainerAppsDiagnosticsClient) listRevisionsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientListRevisionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listRevisionsHandleResponse handles the ListRevisions response. +func (client *ContainerAppsDiagnosticsClient) listRevisionsHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientListRevisionsResponse, error) { + result := ContainerAppsDiagnosticsClientListRevisionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RevisionCollection); err != nil { + return ContainerAppsDiagnosticsClientListRevisionsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/containerappsrevisionreplicas_client.go b/sdk/resourcemanager/app/armapp/containerappsrevisionreplicas_client.go new file mode 100644 index 000000000000..4f5cd054b508 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/containerappsrevisionreplicas_client.go @@ -0,0 +1,185 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ContainerAppsRevisionReplicasClient contains the methods for the ContainerAppsRevisionReplicas group. +// Don't use this type directly, use NewContainerAppsRevisionReplicasClient() instead. +type ContainerAppsRevisionReplicasClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewContainerAppsRevisionReplicasClient creates a new instance of ContainerAppsRevisionReplicasClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewContainerAppsRevisionReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsRevisionReplicasClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ContainerAppsRevisionReplicasClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// GetReplica - Get a replica for a Container App Revision. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// revisionName - Name of the Container App Revision. +// replicaName - Name of the Container App Revision Replica. +// options - ContainerAppsRevisionReplicasClientGetReplicaOptions contains the optional parameters for the ContainerAppsRevisionReplicasClient.GetReplica +// method. +func (client *ContainerAppsRevisionReplicasClient) GetReplica(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, replicaName string, options *ContainerAppsRevisionReplicasClientGetReplicaOptions) (ContainerAppsRevisionReplicasClientGetReplicaResponse, error) { + req, err := client.getReplicaCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, replicaName, options) + if err != nil { + return ContainerAppsRevisionReplicasClientGetReplicaResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsRevisionReplicasClientGetReplicaResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsRevisionReplicasClientGetReplicaResponse{}, runtime.NewResponseError(resp) + } + return client.getReplicaHandleResponse(resp) +} + +// getReplicaCreateRequest creates the GetReplica request. +func (client *ContainerAppsRevisionReplicasClient) getReplicaCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, replicaName string, options *ContainerAppsRevisionReplicasClientGetReplicaOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getReplicaHandleResponse handles the GetReplica response. +func (client *ContainerAppsRevisionReplicasClient) getReplicaHandleResponse(resp *http.Response) (ContainerAppsRevisionReplicasClientGetReplicaResponse, error) { + result := ContainerAppsRevisionReplicasClientGetReplicaResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Replica); err != nil { + return ContainerAppsRevisionReplicasClientGetReplicaResponse{}, err + } + return result, nil +} + +// ListReplicas - List replicas for a Container App Revision. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// revisionName - Name of the Container App Revision. +// options - ContainerAppsRevisionReplicasClientListReplicasOptions contains the optional parameters for the ContainerAppsRevisionReplicasClient.ListReplicas +// method. +func (client *ContainerAppsRevisionReplicasClient) ListReplicas(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionReplicasClientListReplicasOptions) (ContainerAppsRevisionReplicasClientListReplicasResponse, error) { + req, err := client.listReplicasCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, options) + if err != nil { + return ContainerAppsRevisionReplicasClientListReplicasResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsRevisionReplicasClientListReplicasResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsRevisionReplicasClientListReplicasResponse{}, runtime.NewResponseError(resp) + } + return client.listReplicasHandleResponse(resp) +} + +// listReplicasCreateRequest creates the ListReplicas request. +func (client *ContainerAppsRevisionReplicasClient) listReplicasCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionReplicasClientListReplicasOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listReplicasHandleResponse handles the ListReplicas response. +func (client *ContainerAppsRevisionReplicasClient) listReplicasHandleResponse(resp *http.Response) (ContainerAppsRevisionReplicasClientListReplicasResponse, error) { + result := ContainerAppsRevisionReplicasClientListReplicasResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicaCollection); err != nil { + return ContainerAppsRevisionReplicasClientListReplicasResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/containerappsrevisions_client.go b/sdk/resourcemanager/app/armapp/containerappsrevisions_client.go new file mode 100644 index 000000000000..8384e0e87db0 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/containerappsrevisions_client.go @@ -0,0 +1,350 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ContainerAppsRevisionsClient contains the methods for the ContainerAppsRevisions group. +// Don't use this type directly, use NewContainerAppsRevisionsClient() instead. +type ContainerAppsRevisionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewContainerAppsRevisionsClient creates a new instance of ContainerAppsRevisionsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewContainerAppsRevisionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsRevisionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ContainerAppsRevisionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// ActivateRevision - Activates a revision for a Container App +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// revisionName - Name of the Container App Revision. +// options - ContainerAppsRevisionsClientActivateRevisionOptions contains the optional parameters for the ContainerAppsRevisionsClient.ActivateRevision +// method. +func (client *ContainerAppsRevisionsClient) ActivateRevision(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionsClientActivateRevisionOptions) (ContainerAppsRevisionsClientActivateRevisionResponse, error) { + req, err := client.activateRevisionCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, options) + if err != nil { + return ContainerAppsRevisionsClientActivateRevisionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsRevisionsClientActivateRevisionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsRevisionsClientActivateRevisionResponse{}, runtime.NewResponseError(resp) + } + return ContainerAppsRevisionsClientActivateRevisionResponse{}, nil +} + +// activateRevisionCreateRequest creates the ActivateRevision request. +func (client *ContainerAppsRevisionsClient) activateRevisionCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionsClientActivateRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeactivateRevision - Deactivates a revision for a Container App +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// revisionName - Name of the Container App Revision. +// options - ContainerAppsRevisionsClientDeactivateRevisionOptions contains the optional parameters for the ContainerAppsRevisionsClient.DeactivateRevision +// method. +func (client *ContainerAppsRevisionsClient) DeactivateRevision(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionsClientDeactivateRevisionOptions) (ContainerAppsRevisionsClientDeactivateRevisionResponse, error) { + req, err := client.deactivateRevisionCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, options) + if err != nil { + return ContainerAppsRevisionsClientDeactivateRevisionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsRevisionsClientDeactivateRevisionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsRevisionsClientDeactivateRevisionResponse{}, runtime.NewResponseError(resp) + } + return ContainerAppsRevisionsClientDeactivateRevisionResponse{}, nil +} + +// deactivateRevisionCreateRequest creates the DeactivateRevision request. +func (client *ContainerAppsRevisionsClient) deactivateRevisionCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionsClientDeactivateRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetRevision - Get a revision of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// revisionName - Name of the Container App Revision. +// options - ContainerAppsRevisionsClientGetRevisionOptions contains the optional parameters for the ContainerAppsRevisionsClient.GetRevision +// method. +func (client *ContainerAppsRevisionsClient) GetRevision(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionsClientGetRevisionOptions) (ContainerAppsRevisionsClientGetRevisionResponse, error) { + req, err := client.getRevisionCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, options) + if err != nil { + return ContainerAppsRevisionsClientGetRevisionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsRevisionsClientGetRevisionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsRevisionsClientGetRevisionResponse{}, runtime.NewResponseError(resp) + } + return client.getRevisionHandleResponse(resp) +} + +// getRevisionCreateRequest creates the GetRevision request. +func (client *ContainerAppsRevisionsClient) getRevisionCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionsClientGetRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getRevisionHandleResponse handles the GetRevision response. +func (client *ContainerAppsRevisionsClient) getRevisionHandleResponse(resp *http.Response) (ContainerAppsRevisionsClientGetRevisionResponse, error) { + result := ContainerAppsRevisionsClientGetRevisionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Revision); err != nil { + return ContainerAppsRevisionsClientGetRevisionResponse{}, err + } + return result, nil +} + +// NewListRevisionsPager - Get the Revisions for a given Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App for which Revisions are needed. +// options - ContainerAppsRevisionsClientListRevisionsOptions contains the optional parameters for the ContainerAppsRevisionsClient.ListRevisions +// method. +func (client *ContainerAppsRevisionsClient) NewListRevisionsPager(resourceGroupName string, containerAppName string, options *ContainerAppsRevisionsClientListRevisionsOptions) *runtime.Pager[ContainerAppsRevisionsClientListRevisionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsRevisionsClientListRevisionsResponse]{ + More: func(page ContainerAppsRevisionsClientListRevisionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsRevisionsClientListRevisionsResponse) (ContainerAppsRevisionsClientListRevisionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listRevisionsCreateRequest(ctx, resourceGroupName, containerAppName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsRevisionsClientListRevisionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsRevisionsClientListRevisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsRevisionsClientListRevisionsResponse{}, runtime.NewResponseError(resp) + } + return client.listRevisionsHandleResponse(resp) + }, + }) +} + +// listRevisionsCreateRequest creates the ListRevisions request. +func (client *ContainerAppsRevisionsClient) listRevisionsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsRevisionsClientListRevisionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listRevisionsHandleResponse handles the ListRevisions response. +func (client *ContainerAppsRevisionsClient) listRevisionsHandleResponse(resp *http.Response) (ContainerAppsRevisionsClientListRevisionsResponse, error) { + result := ContainerAppsRevisionsClientListRevisionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RevisionCollection); err != nil { + return ContainerAppsRevisionsClientListRevisionsResponse{}, err + } + return result, nil +} + +// RestartRevision - Restarts a revision for a Container App +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// revisionName - Name of the Container App Revision. +// options - ContainerAppsRevisionsClientRestartRevisionOptions contains the optional parameters for the ContainerAppsRevisionsClient.RestartRevision +// method. +func (client *ContainerAppsRevisionsClient) RestartRevision(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionsClientRestartRevisionOptions) (ContainerAppsRevisionsClientRestartRevisionResponse, error) { + req, err := client.restartRevisionCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, options) + if err != nil { + return ContainerAppsRevisionsClientRestartRevisionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsRevisionsClientRestartRevisionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsRevisionsClientRestartRevisionResponse{}, runtime.NewResponseError(resp) + } + return ContainerAppsRevisionsClientRestartRevisionResponse{}, nil +} + +// restartRevisionCreateRequest creates the RestartRevision request. +func (client *ContainerAppsRevisionsClient) restartRevisionCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsRevisionsClientRestartRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/app/armapp/containerappssourcecontrols_client.go b/sdk/resourcemanager/app/armapp/containerappssourcecontrols_client.go new file mode 100644 index 000000000000..df496aacc3c2 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/containerappssourcecontrols_client.go @@ -0,0 +1,325 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ContainerAppsSourceControlsClient contains the methods for the ContainerAppsSourceControls group. +// Don't use this type directly, use NewContainerAppsSourceControlsClient() instead. +type ContainerAppsSourceControlsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewContainerAppsSourceControlsClient creates a new instance of ContainerAppsSourceControlsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewContainerAppsSourceControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsSourceControlsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ContainerAppsSourceControlsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update the SourceControl for a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// sourceControlName - Name of the Container App SourceControl. +// sourceControlEnvelope - Properties used to create a Container App SourceControl +// options - ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerAppsSourceControlsClient.BeginCreateOrUpdate +// method. +func (client *ContainerAppsSourceControlsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, sourceControlEnvelope SourceControl, options *ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ContainerAppsSourceControlsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, containerAppName, sourceControlName, sourceControlEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ContainerAppsSourceControlsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ContainerAppsSourceControlsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update the SourceControl for a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ContainerAppsSourceControlsClient) createOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, sourceControlEnvelope SourceControl, options *ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, containerAppName, sourceControlName, sourceControlEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ContainerAppsSourceControlsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, sourceControlEnvelope SourceControl, options *ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if sourceControlName == "" { + return nil, errors.New("parameter sourceControlName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sourceControlName}", url.PathEscape(sourceControlName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sourceControlEnvelope) +} + +// BeginDelete - Delete a Container App SourceControl. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// sourceControlName - Name of the Container App SourceControl. +// options - ContainerAppsSourceControlsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsSourceControlsClient.BeginDelete +// method. +func (client *ContainerAppsSourceControlsClient) BeginDelete(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, options *ContainerAppsSourceControlsClientBeginDeleteOptions) (*runtime.Poller[ContainerAppsSourceControlsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, containerAppName, sourceControlName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ContainerAppsSourceControlsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ContainerAppsSourceControlsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a Container App SourceControl. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ContainerAppsSourceControlsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, options *ContainerAppsSourceControlsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, containerAppName, sourceControlName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContainerAppsSourceControlsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, options *ContainerAppsSourceControlsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if sourceControlName == "" { + return nil, errors.New("parameter sourceControlName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sourceControlName}", url.PathEscape(sourceControlName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SourceControl of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// sourceControlName - Name of the Container App SourceControl. +// options - ContainerAppsSourceControlsClientGetOptions contains the optional parameters for the ContainerAppsSourceControlsClient.Get +// method. +func (client *ContainerAppsSourceControlsClient) Get(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, options *ContainerAppsSourceControlsClientGetOptions) (ContainerAppsSourceControlsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, containerAppName, sourceControlName, options) + if err != nil { + return ContainerAppsSourceControlsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsSourceControlsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsSourceControlsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ContainerAppsSourceControlsClient) getCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, options *ContainerAppsSourceControlsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if sourceControlName == "" { + return nil, errors.New("parameter sourceControlName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sourceControlName}", url.PathEscape(sourceControlName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ContainerAppsSourceControlsClient) getHandleResponse(resp *http.Response) (ContainerAppsSourceControlsClientGetResponse, error) { + result := ContainerAppsSourceControlsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SourceControl); err != nil { + return ContainerAppsSourceControlsClientGetResponse{}, err + } + return result, nil +} + +// NewListByContainerAppPager - Get the Container App SourceControls in a given resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// options - ContainerAppsSourceControlsClientListByContainerAppOptions contains the optional parameters for the ContainerAppsSourceControlsClient.ListByContainerApp +// method. +func (client *ContainerAppsSourceControlsClient) NewListByContainerAppPager(resourceGroupName string, containerAppName string, options *ContainerAppsSourceControlsClientListByContainerAppOptions) *runtime.Pager[ContainerAppsSourceControlsClientListByContainerAppResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsSourceControlsClientListByContainerAppResponse]{ + More: func(page ContainerAppsSourceControlsClientListByContainerAppResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsSourceControlsClientListByContainerAppResponse) (ContainerAppsSourceControlsClientListByContainerAppResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByContainerAppCreateRequest(ctx, resourceGroupName, containerAppName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsSourceControlsClientListByContainerAppResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsSourceControlsClientListByContainerAppResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsSourceControlsClientListByContainerAppResponse{}, runtime.NewResponseError(resp) + } + return client.listByContainerAppHandleResponse(resp) + }, + }) +} + +// listByContainerAppCreateRequest creates the ListByContainerApp request. +func (client *ContainerAppsSourceControlsClient) listByContainerAppCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsSourceControlsClientListByContainerAppOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols" + 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 containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByContainerAppHandleResponse handles the ListByContainerApp response. +func (client *ContainerAppsSourceControlsClient) listByContainerAppHandleResponse(resp *http.Response) (ContainerAppsSourceControlsClientListByContainerAppResponse, error) { + result := ContainerAppsSourceControlsClientListByContainerAppResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlCollection); err != nil { + return ContainerAppsSourceControlsClientListByContainerAppResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/daprcomponents_client.go b/sdk/resourcemanager/app/armapp/daprcomponents_client.go new file mode 100644 index 000000000000..53d2ea78252f --- /dev/null +++ b/sdk/resourcemanager/app/armapp/daprcomponents_client.go @@ -0,0 +1,363 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// DaprComponentsClient contains the methods for the DaprComponents group. +// Don't use this type directly, use NewDaprComponentsClient() instead. +type DaprComponentsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDaprComponentsClient creates a new instance of DaprComponentsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDaprComponentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DaprComponentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DaprComponentsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a Dapr Component in a Managed Environment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// componentName - Name of the Dapr Component. +// daprComponentEnvelope - Configuration details of the Dapr Component. +// options - DaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the DaprComponentsClient.CreateOrUpdate +// method. +func (client *DaprComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, componentName string, daprComponentEnvelope DaprComponent, options *DaprComponentsClientCreateOrUpdateOptions) (DaprComponentsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, componentName, daprComponentEnvelope, options) + if err != nil { + return DaprComponentsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DaprComponentsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DaprComponentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DaprComponentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, componentName string, daprComponentEnvelope DaprComponent, options *DaprComponentsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, daprComponentEnvelope) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DaprComponentsClient) createOrUpdateHandleResponse(resp *http.Response) (DaprComponentsClientCreateOrUpdateResponse, error) { + result := DaprComponentsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponent); err != nil { + return DaprComponentsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Dapr Component from a Managed Environment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// componentName - Name of the Dapr Component. +// options - DaprComponentsClientDeleteOptions contains the optional parameters for the DaprComponentsClient.Delete method. +func (client *DaprComponentsClient) Delete(ctx context.Context, resourceGroupName string, environmentName string, componentName string, options *DaprComponentsClientDeleteOptions) (DaprComponentsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, componentName, options) + if err != nil { + return DaprComponentsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DaprComponentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return DaprComponentsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return DaprComponentsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DaprComponentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, componentName string, options *DaprComponentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a dapr component. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// componentName - Name of the Dapr Component. +// options - DaprComponentsClientGetOptions contains the optional parameters for the DaprComponentsClient.Get method. +func (client *DaprComponentsClient) Get(ctx context.Context, resourceGroupName string, environmentName string, componentName string, options *DaprComponentsClientGetOptions) (DaprComponentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, environmentName, componentName, options) + if err != nil { + return DaprComponentsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DaprComponentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DaprComponentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DaprComponentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, componentName string, options *DaprComponentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *DaprComponentsClient) getHandleResponse(resp *http.Response) (DaprComponentsClientGetResponse, error) { + result := DaprComponentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponent); err != nil { + return DaprComponentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Dapr Components for a managed environment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// options - DaprComponentsClientListOptions contains the optional parameters for the DaprComponentsClient.List method. +func (client *DaprComponentsClient) NewListPager(resourceGroupName string, environmentName string, options *DaprComponentsClientListOptions) *runtime.Pager[DaprComponentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DaprComponentsClientListResponse]{ + More: func(page DaprComponentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DaprComponentsClientListResponse) (DaprComponentsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, environmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DaprComponentsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DaprComponentsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DaprComponentsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DaprComponentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *DaprComponentsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *DaprComponentsClient) listHandleResponse(resp *http.Response) (DaprComponentsClientListResponse, error) { + result := DaprComponentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponentsCollection); err != nil { + return DaprComponentsClientListResponse{}, err + } + return result, nil +} + +// ListSecrets - List secrets for a dapr component +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// componentName - Name of the Dapr Component. +// options - DaprComponentsClientListSecretsOptions contains the optional parameters for the DaprComponentsClient.ListSecrets +// method. +func (client *DaprComponentsClient) ListSecrets(ctx context.Context, resourceGroupName string, environmentName string, componentName string, options *DaprComponentsClientListSecretsOptions) (DaprComponentsClientListSecretsResponse, error) { + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, environmentName, componentName, options) + if err != nil { + return DaprComponentsClientListSecretsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DaprComponentsClientListSecretsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DaprComponentsClientListSecretsResponse{}, runtime.NewResponseError(resp) + } + return client.listSecretsHandleResponse(resp) +} + +// listSecretsCreateRequest creates the ListSecrets request. +func (client *DaprComponentsClient) listSecretsCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, componentName string, options *DaprComponentsClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecretsHandleResponse handles the ListSecrets response. +func (client *DaprComponentsClient) listSecretsHandleResponse(resp *http.Response) (DaprComponentsClientListSecretsResponse, error) { + result := DaprComponentsClientListSecretsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprSecretsCollection); err != nil { + return DaprComponentsClientListSecretsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/go.mod b/sdk/resourcemanager/app/armapp/go.mod new file mode 100644 index 000000000000..c97a00af0e2f --- /dev/null +++ b/sdk/resourcemanager/app/armapp/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/app/armapp + +go 1.19 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect + golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect +) diff --git a/sdk/resourcemanager/app/armapp/go.sum b/sdk/resourcemanager/app/armapp/go.sum new file mode 100644 index 000000000000..3afb578030a5 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/go.sum @@ -0,0 +1,15 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/app/armapp/managedenvironmentdiagnostics_client.go b/sdk/resourcemanager/app/armapp/managedenvironmentdiagnostics_client.go new file mode 100644 index 000000000000..baf9354dc0e4 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/managedenvironmentdiagnostics_client.go @@ -0,0 +1,175 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ManagedEnvironmentDiagnosticsClient contains the methods for the ManagedEnvironmentDiagnostics group. +// Don't use this type directly, use NewManagedEnvironmentDiagnosticsClient() instead. +type ManagedEnvironmentDiagnosticsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagedEnvironmentDiagnosticsClient creates a new instance of ManagedEnvironmentDiagnosticsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagedEnvironmentDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentDiagnosticsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagedEnvironmentDiagnosticsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// GetDetector - Get the diagnostics data for a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// detectorName - Name of the Managed Environment detector. +// options - ManagedEnvironmentDiagnosticsClientGetDetectorOptions contains the optional parameters for the ManagedEnvironmentDiagnosticsClient.GetDetector +// method. +func (client *ManagedEnvironmentDiagnosticsClient) GetDetector(ctx context.Context, resourceGroupName string, environmentName string, detectorName string, options *ManagedEnvironmentDiagnosticsClientGetDetectorOptions) (ManagedEnvironmentDiagnosticsClientGetDetectorResponse, error) { + req, err := client.getDetectorCreateRequest(ctx, resourceGroupName, environmentName, detectorName, options) + if err != nil { + return ManagedEnvironmentDiagnosticsClientGetDetectorResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentDiagnosticsClientGetDetectorResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentDiagnosticsClientGetDetectorResponse{}, runtime.NewResponseError(resp) + } + return client.getDetectorHandleResponse(resp) +} + +// getDetectorCreateRequest creates the GetDetector request. +func (client *ManagedEnvironmentDiagnosticsClient) getDetectorCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, detectorName string, options *ManagedEnvironmentDiagnosticsClientGetDetectorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if detectorName == "" { + return nil, errors.New("parameter detectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{detectorName}", url.PathEscape(detectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDetectorHandleResponse handles the GetDetector response. +func (client *ManagedEnvironmentDiagnosticsClient) getDetectorHandleResponse(resp *http.Response) (ManagedEnvironmentDiagnosticsClientGetDetectorResponse, error) { + result := ManagedEnvironmentDiagnosticsClientGetDetectorResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Diagnostics); err != nil { + return ManagedEnvironmentDiagnosticsClientGetDetectorResponse{}, err + } + return result, nil +} + +// ListDetectors - Get the list of diagnostics for a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// options - ManagedEnvironmentDiagnosticsClientListDetectorsOptions contains the optional parameters for the ManagedEnvironmentDiagnosticsClient.ListDetectors +// method. +func (client *ManagedEnvironmentDiagnosticsClient) ListDetectors(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentDiagnosticsClientListDetectorsOptions) (ManagedEnvironmentDiagnosticsClientListDetectorsResponse, error) { + req, err := client.listDetectorsCreateRequest(ctx, resourceGroupName, environmentName, options) + if err != nil { + return ManagedEnvironmentDiagnosticsClientListDetectorsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentDiagnosticsClientListDetectorsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentDiagnosticsClientListDetectorsResponse{}, runtime.NewResponseError(resp) + } + return client.listDetectorsHandleResponse(resp) +} + +// listDetectorsCreateRequest creates the ListDetectors request. +func (client *ManagedEnvironmentDiagnosticsClient) listDetectorsCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentDiagnosticsClientListDetectorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listDetectorsHandleResponse handles the ListDetectors response. +func (client *ManagedEnvironmentDiagnosticsClient) listDetectorsHandleResponse(resp *http.Response) (ManagedEnvironmentDiagnosticsClientListDetectorsResponse, error) { + result := ManagedEnvironmentDiagnosticsClientListDetectorsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticsCollection); err != nil { + return ManagedEnvironmentDiagnosticsClientListDetectorsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/managedenvironments_client.go b/sdk/resourcemanager/app/armapp/managedenvironments_client.go new file mode 100644 index 000000000000..adda910442e0 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/managedenvironments_client.go @@ -0,0 +1,428 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ManagedEnvironmentsClient contains the methods for the ManagedEnvironments group. +// Don't use this type directly, use NewManagedEnvironmentsClient() instead. +type ManagedEnvironmentsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagedEnvironmentsClient creates a new instance of ManagedEnvironmentsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagedEnvironmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagedEnvironmentsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// environmentEnvelope - Configuration details of the Environment. +// options - ManagedEnvironmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginCreateOrUpdate +// method. +func (client *ManagedEnvironmentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedEnvironmentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, environmentName, environmentEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ManagedEnvironmentsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ManagedEnvironmentsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ManagedEnvironmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, environmentEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedEnvironmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, environmentEnvelope) +} + +// BeginDelete - Delete a Managed Environment if it does not have any container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// options - ManagedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginDelete +// method. +func (client *ManagedEnvironmentsClient) BeginDelete(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientBeginDeleteOptions) (*runtime.Poller[ManagedEnvironmentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, environmentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ManagedEnvironmentsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ManagedEnvironmentsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a Managed Environment if it does not have any container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ManagedEnvironmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedEnvironmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the properties of a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// options - ManagedEnvironmentsClientGetOptions contains the optional parameters for the ManagedEnvironmentsClient.Get method. +func (client *ManagedEnvironmentsClient) Get(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientGetOptions) (ManagedEnvironmentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, environmentName, options) + if err != nil { + return ManagedEnvironmentsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ManagedEnvironmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ManagedEnvironmentsClient) getHandleResponse(resp *http.Response) (ManagedEnvironmentsClientGetResponse, error) { + result := ManagedEnvironmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironment); err != nil { + return ManagedEnvironmentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all the Managed Environments in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// options - ManagedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ManagedEnvironmentsClient.ListByResourceGroup +// method. +func (client *ManagedEnvironmentsClient) NewListByResourceGroupPager(resourceGroupName string, options *ManagedEnvironmentsClientListByResourceGroupOptions) *runtime.Pager[ManagedEnvironmentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedEnvironmentsClientListByResourceGroupResponse]{ + More: func(page ManagedEnvironmentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedEnvironmentsClientListByResourceGroupResponse) (ManagedEnvironmentsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedEnvironmentsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ManagedEnvironmentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ManagedEnvironmentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments" + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ManagedEnvironmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedEnvironmentsClientListByResourceGroupResponse, error) { + result := ManagedEnvironmentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironmentsCollection); err != nil { + return ManagedEnvironmentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get all Managed Environments for a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// options - ManagedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ManagedEnvironmentsClient.ListBySubscription +// method. +func (client *ManagedEnvironmentsClient) NewListBySubscriptionPager(options *ManagedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ManagedEnvironmentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedEnvironmentsClientListBySubscriptionResponse]{ + More: func(page ManagedEnvironmentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedEnvironmentsClientListBySubscriptionResponse) (ManagedEnvironmentsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedEnvironmentsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ManagedEnvironmentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ManagedEnvironmentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ManagedEnvironmentsClient) listBySubscriptionHandleResponse(resp *http.Response) (ManagedEnvironmentsClientListBySubscriptionResponse, error) { + result := ManagedEnvironmentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironmentsCollection); err != nil { + return ManagedEnvironmentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Patches a Managed Environment using JSON Merge Patch +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// environmentEnvelope - Configuration details of the Environment. +// options - ManagedEnvironmentsClientBeginUpdateOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginUpdate +// method. +func (client *ManagedEnvironmentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginUpdateOptions) (*runtime.Poller[ManagedEnvironmentsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, environmentName, environmentEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ManagedEnvironmentsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ManagedEnvironmentsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Patches a Managed Environment using JSON Merge Patch +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +func (client *ManagedEnvironmentsClient) update(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, environmentName, environmentEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ManagedEnvironmentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, environmentEnvelope) +} diff --git a/sdk/resourcemanager/app/armapp/managedenvironmentsdiagnostics_client.go b/sdk/resourcemanager/app/armapp/managedenvironmentsdiagnostics_client.go new file mode 100644 index 000000000000..4266e57455df --- /dev/null +++ b/sdk/resourcemanager/app/armapp/managedenvironmentsdiagnostics_client.go @@ -0,0 +1,113 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ManagedEnvironmentsDiagnosticsClient contains the methods for the ManagedEnvironmentsDiagnostics group. +// Don't use this type directly, use NewManagedEnvironmentsDiagnosticsClient() instead. +type ManagedEnvironmentsDiagnosticsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagedEnvironmentsDiagnosticsClient creates a new instance of ManagedEnvironmentsDiagnosticsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagedEnvironmentsDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentsDiagnosticsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagedEnvironmentsDiagnosticsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// GetRoot - Get the properties of a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// options - ManagedEnvironmentsDiagnosticsClientGetRootOptions contains the optional parameters for the ManagedEnvironmentsDiagnosticsClient.GetRoot +// method. +func (client *ManagedEnvironmentsDiagnosticsClient) GetRoot(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsDiagnosticsClientGetRootOptions) (ManagedEnvironmentsDiagnosticsClientGetRootResponse, error) { + req, err := client.getRootCreateRequest(ctx, resourceGroupName, environmentName, options) + if err != nil { + return ManagedEnvironmentsDiagnosticsClientGetRootResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsDiagnosticsClientGetRootResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsDiagnosticsClientGetRootResponse{}, runtime.NewResponseError(resp) + } + return client.getRootHandleResponse(resp) +} + +// getRootCreateRequest creates the GetRoot request. +func (client *ManagedEnvironmentsDiagnosticsClient) getRootCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsDiagnosticsClientGetRootOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getRootHandleResponse handles the GetRoot response. +func (client *ManagedEnvironmentsDiagnosticsClient) getRootHandleResponse(resp *http.Response) (ManagedEnvironmentsDiagnosticsClientGetRootResponse, error) { + result := ManagedEnvironmentsDiagnosticsClientGetRootResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironment); err != nil { + return ManagedEnvironmentsDiagnosticsClientGetRootResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/managedenvironmentsstorages_client.go b/sdk/resourcemanager/app/armapp/managedenvironmentsstorages_client.go new file mode 100644 index 000000000000..9adf3af602d9 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/managedenvironmentsstorages_client.go @@ -0,0 +1,291 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ManagedEnvironmentsStoragesClient contains the methods for the ManagedEnvironmentsStorages group. +// Don't use this type directly, use NewManagedEnvironmentsStoragesClient() instead. +type ManagedEnvironmentsStoragesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagedEnvironmentsStoragesClient creates a new instance of ManagedEnvironmentsStoragesClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagedEnvironmentsStoragesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentsStoragesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagedEnvironmentsStoragesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or update storage for a managedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// storageName - Name of the storage. +// storageEnvelope - Configuration details of storage. +// options - ManagedEnvironmentsStoragesClientCreateOrUpdateOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.CreateOrUpdate +// method. +func (client *ManagedEnvironmentsStoragesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, storageName string, storageEnvelope ManagedEnvironmentStorage, options *ManagedEnvironmentsStoragesClientCreateOrUpdateOptions) (ManagedEnvironmentsStoragesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, storageName, storageEnvelope, options) + if err != nil { + return ManagedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsStoragesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedEnvironmentsStoragesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, storageName string, storageEnvelope ManagedEnvironmentStorage, options *ManagedEnvironmentsStoragesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, storageEnvelope) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ManagedEnvironmentsStoragesClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedEnvironmentsStoragesClientCreateOrUpdateResponse, error) { + result := ManagedEnvironmentsStoragesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironmentStorage); err != nil { + return ManagedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete storage for a managedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// storageName - Name of the storage. +// options - ManagedEnvironmentsStoragesClientDeleteOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.Delete +// method. +func (client *ManagedEnvironmentsStoragesClient) Delete(ctx context.Context, resourceGroupName string, environmentName string, storageName string, options *ManagedEnvironmentsStoragesClientDeleteOptions) (ManagedEnvironmentsStoragesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, storageName, options) + if err != nil { + return ManagedEnvironmentsStoragesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsStoragesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ManagedEnvironmentsStoragesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ManagedEnvironmentsStoragesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedEnvironmentsStoragesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, storageName string, options *ManagedEnvironmentsStoragesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get storage for a managedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// storageName - Name of the storage. +// options - ManagedEnvironmentsStoragesClientGetOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.Get +// method. +func (client *ManagedEnvironmentsStoragesClient) Get(ctx context.Context, resourceGroupName string, environmentName string, storageName string, options *ManagedEnvironmentsStoragesClientGetOptions) (ManagedEnvironmentsStoragesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, environmentName, storageName, options) + if err != nil { + return ManagedEnvironmentsStoragesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsStoragesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsStoragesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ManagedEnvironmentsStoragesClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, storageName string, options *ManagedEnvironmentsStoragesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ManagedEnvironmentsStoragesClient) getHandleResponse(resp *http.Response) (ManagedEnvironmentsStoragesClientGetResponse, error) { + result := ManagedEnvironmentsStoragesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironmentStorage); err != nil { + return ManagedEnvironmentsStoragesClientGetResponse{}, err + } + return result, nil +} + +// List - Get all storages for a managedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Environment. +// options - ManagedEnvironmentsStoragesClientListOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.List +// method. +func (client *ManagedEnvironmentsStoragesClient) List(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsStoragesClientListOptions) (ManagedEnvironmentsStoragesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, environmentName, options) + if err != nil { + return ManagedEnvironmentsStoragesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsStoragesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsStoragesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ManagedEnvironmentsStoragesClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsStoragesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *ManagedEnvironmentsStoragesClient) listHandleResponse(resp *http.Response) (ManagedEnvironmentsStoragesClientListResponse, error) { + result := ManagedEnvironmentsStoragesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironmentStoragesCollection); err != nil { + return ManagedEnvironmentsStoragesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/models.go b/sdk/resourcemanager/app/armapp/models.go new file mode 100644 index 000000000000..e94a3b06df85 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/models.go @@ -0,0 +1,2521 @@ +//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 armapp + +import "time" + +// AllowedAudiencesValidation - The configuration settings of the Allowed Audiences validation flow. +type AllowedAudiencesValidation struct { + // The configuration settings of the allowed list of audiences from which to validate the JWT token. + AllowedAudiences []*string `json:"allowedAudiences,omitempty"` +} + +// AllowedPrincipals - The configuration settings of the Azure Active Directory allowed principals. +type AllowedPrincipals struct { + // The list of the allowed groups. + Groups []*string `json:"groups,omitempty"` + + // The list of the allowed identities. + Identities []*string `json:"identities,omitempty"` +} + +// Apple - The configuration settings of the Apple provider. +type Apple struct { + // false if the Apple provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + + // The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` + + // The configuration settings of the Apple registration. + Registration *AppleRegistration `json:"registration,omitempty"` +} + +// AppleRegistration - The configuration settings of the registration for the Apple provider +type AppleRegistration struct { + // The Client ID of the app used for login. + ClientID *string `json:"clientId,omitempty"` + + // The app setting name that contains the client secret. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` +} + +// AuthConfig - Configuration settings for the Azure ContainerApp Service Authentication / Authorization feature. +type AuthConfig struct { + // AuthConfig resource specific properties + Properties *AuthConfigProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AuthConfigCollection - AuthConfig collection ARM resource. +type AuthConfigCollection struct { + // REQUIRED; Collection of resources. + Value []*AuthConfig `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// AuthConfigProperties - AuthConfig resource specific properties +type AuthConfigProperties struct { + // The configuration settings that determines the validation flow of users using Service Authentication/Authorization. + GlobalValidation *GlobalValidation `json:"globalValidation,omitempty"` + + // The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp + // Service Authentication/Authorization. + HTTPSettings *HTTPSettings `json:"httpSettings,omitempty"` + + // The configuration settings of each of the identity providers used to configure ContainerApp Service Authentication/Authorization. + IdentityProviders *IdentityProviders `json:"identityProviders,omitempty"` + + // The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. + Login *Login `json:"login,omitempty"` + + // The configuration settings of the platform of ContainerApp Service Authentication/Authorization. + Platform *AuthPlatform `json:"platform,omitempty"` +} + +// AuthPlatform - The configuration settings of the platform of ContainerApp Service Authentication/Authorization. +type AuthPlatform struct { + // true if the Authentication / Authorization feature is enabled for the current app; otherwise, false. + Enabled *bool `json:"enabled,omitempty"` + + // The RuntimeVersion of the Authentication / Authorization feature in use for the current app. The setting in this value + // can control the behavior of certain features in the Authentication / + // Authorization module. + RuntimeVersion *string `json:"runtimeVersion,omitempty"` +} + +// AvailableOperations - Available operations of the service +type AvailableOperations struct { + // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` + + // Collection of available operation details + Value []*OperationDetail `json:"value,omitempty"` +} + +// AzureActiveDirectory - The configuration settings of the Azure Active directory provider. +type AzureActiveDirectory struct { + // false if the Azure Active Directory provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + + // Gets a value indicating whether the Azure AD configuration was auto-provisioned using 1st party tooling. This is an internal + // flag primarily intended to support the Azure Management Portal. Users + // should not read or write to this property. + IsAutoProvisioned *bool `json:"isAutoProvisioned,omitempty"` + + // The configuration settings of the Azure Active Directory login flow. + Login *AzureActiveDirectoryLogin `json:"login,omitempty"` + + // The configuration settings of the Azure Active Directory app registration. + Registration *AzureActiveDirectoryRegistration `json:"registration,omitempty"` + + // The configuration settings of the Azure Active Directory token validation flow. + Validation *AzureActiveDirectoryValidation `json:"validation,omitempty"` +} + +// AzureActiveDirectoryLogin - The configuration settings of the Azure Active Directory login flow. +type AzureActiveDirectoryLogin struct { + // true if the www-authenticate provider should be omitted from the request; otherwise, false. + DisableWWWAuthenticate *bool `json:"disableWWWAuthenticate,omitempty"` + + // Login parameters to send to the OpenID Connect authorization endpoint when a user logs in. Each parameter must be in the + // form "key=value". + LoginParameters []*string `json:"loginParameters,omitempty"` +} + +// AzureActiveDirectoryRegistration - The configuration settings of the Azure Active Directory app registration. +type AzureActiveDirectoryRegistration struct { + // The Client ID of this relying party application, known as the clientid. This setting is required for enabling OpenID Connection + // authentication with Azure Active Directory or other 3rd party OpenID + // Connect providers. More information on OpenID Connect: http://openid.net/specs/openid-connect-core-10.html + ClientID *string `json:"clientId,omitempty"` + + // An alternative to the client secret thumbprint, that is the issuer of a certificate used for signing purposes. This property + // acts as a replacement for the Client Secret Certificate Thumbprint. It is + // also optional. + ClientSecretCertificateIssuer *string `json:"clientSecretCertificateIssuer,omitempty"` + + // An alternative to the client secret thumbprint, that is the subject alternative name of a certificate used for signing + // purposes. This property acts as a replacement for the Client Secret Certificate + // Thumbprint. It is also optional. + ClientSecretCertificateSubjectAlternativeName *string `json:"clientSecretCertificateSubjectAlternativeName,omitempty"` + + // An alternative to the client secret, that is the thumbprint of a certificate used for signing purposes. This property acts + // as a replacement for the Client Secret. It is also optional. + ClientSecretCertificateThumbprint *string `json:"clientSecretCertificateThumbprint,omitempty"` + + // The app setting name that contains the client secret of the relying party application. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` + + // The OpenID Connect Issuer URI that represents the entity which issues access tokens for this application. When using Azure + // Active Directory, this value is the URI of the directory tenant, e.g. + // https://login.microsoftonline.com/v2.0/{tenant-guid}/. This URI is a case-sensitive identifier for the token issuer. More + // information on OpenID Connect Discovery: + // http://openid.net/specs/openid-connect-discovery-1_0.html + OpenIDIssuer *string `json:"openIdIssuer,omitempty"` +} + +// AzureActiveDirectoryValidation - The configuration settings of the Azure Active Directory token validation flow. +type AzureActiveDirectoryValidation struct { + // The list of audiences that can make successful authentication/authorization requests. + AllowedAudiences []*string `json:"allowedAudiences,omitempty"` + + // The configuration settings of the default authorization policy. + DefaultAuthorizationPolicy *DefaultAuthorizationPolicy `json:"defaultAuthorizationPolicy,omitempty"` + + // The configuration settings of the checks that should be made while validating the JWT Claims. + JwtClaimChecks *JwtClaimChecks `json:"jwtClaimChecks,omitempty"` +} + +// AzureCredentials - Container App credentials. +type AzureCredentials struct { + // Client Id. + ClientID *string `json:"clientId,omitempty"` + + // Client Secret. + ClientSecret *string `json:"clientSecret,omitempty"` + + // Subscription Id. + SubscriptionID *string `json:"subscriptionId,omitempty"` + + // Tenant Id. + TenantID *string `json:"tenantId,omitempty"` +} + +// AzureFileProperties - Azure File Properties. +type AzureFileProperties struct { + // Access mode for storage + AccessMode *AccessMode `json:"accessMode,omitempty"` + + // Storage account key for azure file. + AccountKey *string `json:"accountKey,omitempty"` + + // Storage account name for azure file. + AccountName *string `json:"accountName,omitempty"` + + // Azure file share name. + ShareName *string `json:"shareName,omitempty"` +} + +// AzureStaticWebApps - The configuration settings of the Azure Static Web Apps provider. +type AzureStaticWebApps struct { + // false if the Azure Static Web Apps provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + + // The configuration settings of the Azure Static Web Apps registration. + Registration *AzureStaticWebAppsRegistration `json:"registration,omitempty"` +} + +// AzureStaticWebAppsRegistration - The configuration settings of the registration for the Azure Static Web Apps provider +type AzureStaticWebAppsRegistration struct { + // The Client ID of the app used for login. + ClientID *string `json:"clientId,omitempty"` +} + +// BaseContainer - Container App base container definition. +type BaseContainer struct { + // Container start command arguments. + Args []*string `json:"args,omitempty"` + + // Container start command. + Command []*string `json:"command,omitempty"` + + // Container environment variables. + Env []*EnvironmentVar `json:"env,omitempty"` + + // Container image tag. + Image *string `json:"image,omitempty"` + + // Custom container name. + Name *string `json:"name,omitempty"` + + // Container resource requirements. + Resources *ContainerResources `json:"resources,omitempty"` + + // Container volume mounts. + VolumeMounts []*VolumeMount `json:"volumeMounts,omitempty"` +} + +// Certificate used for Custom Domain bindings of Container Apps in a Managed Environment +type Certificate struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Certificate resource specific properties + Properties *CertificateProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CertificateCollection - Collection of Certificates. +type CertificateCollection struct { + // REQUIRED; Collection of resources. + Value []*Certificate `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// CertificatePatch - A certificate to update +type CertificatePatch struct { + // Application-specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags,omitempty"` +} + +// CertificateProperties - Certificate resource specific properties +type CertificateProperties struct { + // Certificate password. + Password *string `json:"password,omitempty"` + + // PFX or PEM blob + Value []byte `json:"value,omitempty"` + + // READ-ONLY; Certificate expiration date. + ExpirationDate *time.Time `json:"expirationDate,omitempty" azure:"ro"` + + // READ-ONLY; Certificate issue Date. + IssueDate *time.Time `json:"issueDate,omitempty" azure:"ro"` + + // READ-ONLY; Certificate issuer. + Issuer *string `json:"issuer,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the certificate. + ProvisioningState *CertificateProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Public key hash. + PublicKeyHash *string `json:"publicKeyHash,omitempty" azure:"ro"` + + // READ-ONLY; Subject alternative names the certificate applies to. + SubjectAlternativeNames []*string `json:"subjectAlternativeNames,omitempty" azure:"ro"` + + // READ-ONLY; Subject name of the certificate. + SubjectName *string `json:"subjectName,omitempty" azure:"ro"` + + // READ-ONLY; Certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` + + // READ-ONLY; Is the certificate valid?. + Valid *bool `json:"valid,omitempty" azure:"ro"` +} + +// CertificatesClientCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.CreateOrUpdate method. +type CertificatesClientCreateOrUpdateOptions struct { + // Certificate to be created or updated + CertificateEnvelope *Certificate +} + +// CertificatesClientDeleteOptions contains the optional parameters for the CertificatesClient.Delete method. +type CertificatesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. +type CertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientListOptions contains the optional parameters for the CertificatesClient.List method. +type CertificatesClientListOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientUpdateOptions contains the optional parameters for the CertificatesClient.Update method. +type CertificatesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// CheckNameAvailabilityRequest - The check availability request body. +type CheckNameAvailabilityRequest struct { + // The name of the resource for which availability needs to be checked. + Name *string `json:"name,omitempty"` + + // The resource type. + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityResponse - The check availability result. +type CheckNameAvailabilityResponse struct { + // Detailed reason why the given name is available. + Message *string `json:"message,omitempty"` + + // Indicates if the resource name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + + // The reason why the given name is not available. + Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` +} + +// ClientRegistration - The configuration settings of the app registration for providers that have client ids and client secrets +type ClientRegistration struct { + // The Client ID of the app used for login. + ClientID *string `json:"clientId,omitempty"` + + // The app setting name that contains the client secret. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` +} + +// Configuration - Non versioned Container App configuration properties that define the mutable settings of a Container app +type Configuration struct { + // ActiveRevisionsMode controls how active revisions are handled for the Container app:Multiple: multiple revisions can be + // active.Single: Only one revision can be active at a time. Revision weights can + // not be used in this mode. If no value if provided, this is the default. + ActiveRevisionsMode *ActiveRevisionsMode `json:"activeRevisionsMode,omitempty"` + + // Dapr configuration for the Container App. + Dapr *Dapr `json:"dapr,omitempty"` + + // Ingress configurations. + Ingress *Ingress `json:"ingress,omitempty"` + + // Optional. Max inactive revisions a Container App can have. + MaxInactiveRevisions *int32 `json:"maxInactiveRevisions,omitempty"` + + // Collection of private container registry credentials for containers used by the Container app + Registries []*RegistryCredentials `json:"registries,omitempty"` + + // Collection of secrets used by a Container app + Secrets []*Secret `json:"secrets,omitempty"` +} + +// ConnectedEnvironment - An environment for Kubernetes cluster specialized for web workloads by Azure App Service +type ConnectedEnvironment struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // The complex type of the extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // ConnectedEnvironment resource specific properties + Properties *ConnectedEnvironmentProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ConnectedEnvironmentCollection - Collection of connectedEnvironments +type ConnectedEnvironmentCollection struct { + // Collection of resources. + Value []*ConnectedEnvironment `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ConnectedEnvironmentProperties - ConnectedEnvironment resource specific properties +type ConnectedEnvironmentProperties struct { + // Application Insights connection string used by Dapr to export Service to Service communication telemetry + DaprAIConnectionString *string `json:"daprAIConnectionString,omitempty"` + + // Static IP of the connectedEnvironment + StaticIP *string `json:"staticIp,omitempty"` + + // READ-ONLY; Default Domain Name for the cluster + DefaultDomain *string `json:"defaultDomain,omitempty" azure:"ro"` + + // READ-ONLY; Any errors that occurred during deployment or deployment validation + DeploymentErrors *string `json:"deploymentErrors,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the Kubernetes Environment. + ProvisioningState *ConnectedEnvironmentProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ConnectedEnvironmentStorage - Storage resource for connectedEnvironment. +type ConnectedEnvironmentStorage struct { + // Storage properties + Properties *ConnectedEnvironmentStorageProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ConnectedEnvironmentStorageProperties - Storage properties +type ConnectedEnvironmentStorageProperties struct { + // Azure file properties + AzureFile *AzureFileProperties `json:"azureFile,omitempty"` +} + +// ConnectedEnvironmentStoragesCollection - Collection of Storage for Environments +type ConnectedEnvironmentStoragesCollection struct { + // REQUIRED; Collection of storage resources. + Value []*ConnectedEnvironmentStorage `json:"value,omitempty"` +} + +// ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.CreateOrUpdate +// method. +type ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions struct { + // Certificate to be created or updated + CertificateEnvelope *Certificate +} + +// ConnectedEnvironmentsCertificatesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Delete +// method. +type ConnectedEnvironmentsCertificatesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsCertificatesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Get +// method. +type ConnectedEnvironmentsCertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsCertificatesClientListOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.List +// method. +type ConnectedEnvironmentsCertificatesClientListOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsCertificatesClientUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Update +// method. +type ConnectedEnvironmentsCertificatesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsClient.BeginCreateOrUpdate +// method. +type ConnectedEnvironmentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsClient.BeginDelete +// method. +type ConnectedEnvironmentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectedEnvironmentsClientCheckNameAvailabilityOptions contains the optional parameters for the ConnectedEnvironmentsClient.CheckNameAvailability +// method. +type ConnectedEnvironmentsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsClient.Get method. +type ConnectedEnvironmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ConnectedEnvironmentsClient.ListByResourceGroup +// method. +type ConnectedEnvironmentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ConnectedEnvironmentsClient.ListBySubscription +// method. +type ConnectedEnvironmentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientUpdateOptions contains the optional parameters for the ConnectedEnvironmentsClient.Update method. +type ConnectedEnvironmentsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate +// method. +type ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Delete +// method. +type ConnectedEnvironmentsDaprComponentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Get +// method. +type ConnectedEnvironmentsDaprComponentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientListOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.List +// method. +type ConnectedEnvironmentsDaprComponentsClientListOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientListSecretsOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.ListSecrets +// method. +type ConnectedEnvironmentsDaprComponentsClientListSecretsOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.CreateOrUpdate +// method. +type ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsStoragesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Delete +// method. +type ConnectedEnvironmentsStoragesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsStoragesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Get +// method. +type ConnectedEnvironmentsStoragesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsStoragesClientListOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.List +// method. +type ConnectedEnvironmentsStoragesClientListOptions struct { + // placeholder for future optional parameters +} + +// Container App container definition +type Container struct { + // Container start command arguments. + Args []*string `json:"args,omitempty"` + + // Container start command. + Command []*string `json:"command,omitempty"` + + // Container environment variables. + Env []*EnvironmentVar `json:"env,omitempty"` + + // Container image tag. + Image *string `json:"image,omitempty"` + + // Custom container name. + Name *string `json:"name,omitempty"` + + // List of probes for the container. + Probes []*ContainerAppProbe `json:"probes,omitempty"` + + // Container resource requirements. + Resources *ContainerResources `json:"resources,omitempty"` + + // Container volume mounts. + VolumeMounts []*VolumeMount `json:"volumeMounts,omitempty"` +} + +// ContainerApp - Container App. +type ContainerApp struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // The complex type of the extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // managed identities for the Container App to interact with other Azure services without maintaining any secrets or credentials + // in code. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + + // ContainerApp resource specific properties + Properties *ContainerAppProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ContainerAppCollection - Container App collection ARM resource. +type ContainerAppCollection struct { + // REQUIRED; Collection of resources. + Value []*ContainerApp `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ContainerAppProbe - Probe describes a health check to be performed against a container to determine whether it is alive +// or ready to receive traffic. +type ContainerAppProbe struct { + // Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value + // is 1. Maximum value is 10. + FailureThreshold *int32 `json:"failureThreshold,omitempty"` + + // HTTPGet specifies the http request to perform. + HTTPGet *ContainerAppProbeHTTPGet `json:"httpGet,omitempty"` + + // Number of seconds after the container has started before liveness probes are initiated. Minimum value is 1. Maximum value + // is 60. + InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` + + // How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum value is 240. + PeriodSeconds *int32 `json:"periodSeconds,omitempty"` + + // Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for + // liveness and startup. Minimum value is 1. Maximum value is 10. + SuccessThreshold *int32 `json:"successThreshold,omitempty"` + + // TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. + TCPSocket *ContainerAppProbeTCPSocket `json:"tcpSocket,omitempty"` + + // Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration + // in seconds after the processes running in the pod are sent a termination signal + // and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup + // time for your process. If this value is nil, the pod's + // terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must + // be non-negative integer. The value zero indicates stop immediately via the + // kill signal (no opportunity to shut down). This is an alpha field and requires enabling ProbeTerminationGracePeriod feature + // gate. Maximum value is 3600 seconds (1 hour) + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` + + // Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 240. + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + + // The type of probe. + Type *Type `json:"type,omitempty"` +} + +// ContainerAppProbeHTTPGet - HTTPGet specifies the http request to perform. +type ContainerAppProbeHTTPGet struct { + // REQUIRED; Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an + // IANASVCNAME. + Port *int32 `json:"port,omitempty"` + + // Custom headers to set in the request. HTTP allows repeated headers. + HTTPHeaders []*ContainerAppProbeHTTPGetHTTPHeadersItem `json:"httpHeaders,omitempty"` + + // Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead. + Host *string `json:"host,omitempty"` + + // Path to access on the HTTP server. + Path *string `json:"path,omitempty"` + + // Scheme to use for connecting to the host. Defaults to HTTP. + Scheme *Scheme `json:"scheme,omitempty"` +} + +// ContainerAppProbeHTTPGetHTTPHeadersItem - HTTPHeader describes a custom header to be used in HTTP probes +type ContainerAppProbeHTTPGetHTTPHeadersItem struct { + // REQUIRED; The header field name + Name *string `json:"name,omitempty"` + + // REQUIRED; The header field value + Value *string `json:"value,omitempty"` +} + +// ContainerAppProbeTCPSocket - TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. +type ContainerAppProbeTCPSocket struct { + // REQUIRED; Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an + // IANASVCNAME. + Port *int32 `json:"port,omitempty"` + + // Optional: Host name to connect to, defaults to the pod IP. + Host *string `json:"host,omitempty"` +} + +// ContainerAppProperties - ContainerApp resource specific properties +type ContainerAppProperties struct { + // Non versioned Container App configuration properties. + Configuration *Configuration `json:"configuration,omitempty"` + + // Resource ID of environment. + EnvironmentID *string `json:"environmentId,omitempty"` + + // Deprecated. Resource ID of the Container App's environment. + ManagedEnvironmentID *string `json:"managedEnvironmentId,omitempty"` + + // Container App versioned application definition. + Template *Template `json:"template,omitempty"` + + // Workload profile type to pin for container app execution. + WorkloadProfileType *string `json:"workloadProfileType,omitempty"` + + // READ-ONLY; Id used to verify domain name ownership + CustomDomainVerificationID *string `json:"customDomainVerificationId,omitempty" azure:"ro"` + + // READ-ONLY; Fully Qualified Domain Name of the latest revision of the Container App. + LatestRevisionFqdn *string `json:"latestRevisionFqdn,omitempty" azure:"ro"` + + // READ-ONLY; Name of the latest revision of the Container App. + LatestRevisionName *string `json:"latestRevisionName,omitempty" azure:"ro"` + + // READ-ONLY; Outbound IP Addresses for container app. + OutboundIPAddresses []*string `json:"outboundIPAddresses,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the Container App. + ProvisioningState *ContainerAppProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ContainerAppSecret - Container App Secret. +type ContainerAppSecret struct { + // READ-ONLY; Secret Name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Secret Value. + Value *string `json:"value,omitempty" azure:"ro"` +} + +// ContainerAppsAuthConfigsClientCreateOrUpdateOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.CreateOrUpdate +// method. +type ContainerAppsAuthConfigsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsAuthConfigsClientDeleteOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.Delete +// method. +type ContainerAppsAuthConfigsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsAuthConfigsClientGetOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.Get method. +type ContainerAppsAuthConfigsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsAuthConfigsClientListByContainerAppOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.ListByContainerApp +// method. +type ContainerAppsAuthConfigsClientListByContainerAppOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerAppsClient.BeginCreateOrUpdate +// method. +type ContainerAppsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsClient.BeginDelete method. +type ContainerAppsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsClientBeginUpdateOptions contains the optional parameters for the ContainerAppsClient.BeginUpdate method. +type ContainerAppsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsClientGetOptions contains the optional parameters for the ContainerAppsClient.Get method. +type ContainerAppsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsClientListByResourceGroupOptions contains the optional parameters for the ContainerAppsClient.ListByResourceGroup +// method. +type ContainerAppsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsClient.ListBySubscription +// method. +type ContainerAppsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsClientListCustomHostNameAnalysisOptions contains the optional parameters for the ContainerAppsClient.ListCustomHostNameAnalysis +// method. +type ContainerAppsClientListCustomHostNameAnalysisOptions struct { + // Custom hostname. + CustomHostname *string +} + +// ContainerAppsClientListSecretsOptions contains the optional parameters for the ContainerAppsClient.ListSecrets method. +type ContainerAppsClientListSecretsOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientGetDetectorOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetDetector +// method. +type ContainerAppsDiagnosticsClientGetDetectorOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientGetRevisionOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetRevision +// method. +type ContainerAppsDiagnosticsClientGetRevisionOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientGetRootOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetRoot +// method. +type ContainerAppsDiagnosticsClientGetRootOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientListDetectorsOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.ListDetectors +// method. +type ContainerAppsDiagnosticsClientListDetectorsOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientListRevisionsOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.ListRevisions +// method. +type ContainerAppsDiagnosticsClientListRevisionsOptions struct { + // The filter to apply on the operation. + Filter *string +} + +// ContainerAppsRevisionReplicasClientGetReplicaOptions contains the optional parameters for the ContainerAppsRevisionReplicasClient.GetReplica +// method. +type ContainerAppsRevisionReplicasClientGetReplicaOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsRevisionReplicasClientListReplicasOptions contains the optional parameters for the ContainerAppsRevisionReplicasClient.ListReplicas +// method. +type ContainerAppsRevisionReplicasClientListReplicasOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsRevisionsClientActivateRevisionOptions contains the optional parameters for the ContainerAppsRevisionsClient.ActivateRevision +// method. +type ContainerAppsRevisionsClientActivateRevisionOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsRevisionsClientDeactivateRevisionOptions contains the optional parameters for the ContainerAppsRevisionsClient.DeactivateRevision +// method. +type ContainerAppsRevisionsClientDeactivateRevisionOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsRevisionsClientGetRevisionOptions contains the optional parameters for the ContainerAppsRevisionsClient.GetRevision +// method. +type ContainerAppsRevisionsClientGetRevisionOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsRevisionsClientListRevisionsOptions contains the optional parameters for the ContainerAppsRevisionsClient.ListRevisions +// method. +type ContainerAppsRevisionsClientListRevisionsOptions struct { + // The filter to apply on the operation. + Filter *string +} + +// ContainerAppsRevisionsClientRestartRevisionOptions contains the optional parameters for the ContainerAppsRevisionsClient.RestartRevision +// method. +type ContainerAppsRevisionsClientRestartRevisionOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerAppsSourceControlsClient.BeginCreateOrUpdate +// method. +type ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsSourceControlsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsSourceControlsClient.BeginDelete +// method. +type ContainerAppsSourceControlsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsSourceControlsClientGetOptions contains the optional parameters for the ContainerAppsSourceControlsClient.Get +// method. +type ContainerAppsSourceControlsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsSourceControlsClientListByContainerAppOptions contains the optional parameters for the ContainerAppsSourceControlsClient.ListByContainerApp +// method. +type ContainerAppsSourceControlsClientListByContainerAppOptions struct { + // placeholder for future optional parameters +} + +// ContainerResources - Container App container resource requirements. +type ContainerResources struct { + // Required CPU in cores, e.g. 0.5 + CPU *float64 `json:"cpu,omitempty"` + + // Required memory, e.g. "250Mb" + Memory *string `json:"memory,omitempty"` + + // READ-ONLY; Ephemeral Storage, e.g. "1Gi" + EphemeralStorage *string `json:"ephemeralStorage,omitempty" azure:"ro"` +} + +// CookieExpiration - The configuration settings of the session cookie's expiration. +type CookieExpiration struct { + // The convention used when determining the session cookie's expiration. + Convention *CookieExpirationConvention `json:"convention,omitempty"` + + // The time after the request is made when the session cookie should expire. + TimeToExpiration *string `json:"timeToExpiration,omitempty"` +} + +// CustomDomain - Custom Domain of a Container App +type CustomDomain struct { + // REQUIRED; Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. + CertificateID *string `json:"certificateId,omitempty"` + + // REQUIRED; Hostname. + Name *string `json:"name,omitempty"` + + // Custom Domain binding type. + BindingType *BindingType `json:"bindingType,omitempty"` +} + +// CustomDomainConfiguration - Configuration properties for apps environment custom domain +type CustomDomainConfiguration struct { + // Certificate password + CertificatePassword []byte `json:"certificatePassword,omitempty"` + + // PFX or PEM blob + CertificateValue []byte `json:"certificateValue,omitempty"` + + // Dns suffix for the environment domain + DNSSuffix *string `json:"dnsSuffix,omitempty"` + + // READ-ONLY; Id used to verify domain name ownership + CustomDomainVerificationID *string `json:"customDomainVerificationId,omitempty" azure:"ro"` + + // READ-ONLY; Certificate expiration date. + ExpirationDate *time.Time `json:"expirationDate,omitempty" azure:"ro"` + + // READ-ONLY; Subject name of the certificate. + SubjectName *string `json:"subjectName,omitempty" azure:"ro"` + + // READ-ONLY; Certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` +} + +// CustomHostnameAnalysisResult - Custom domain analysis. +type CustomHostnameAnalysisResult struct { + // A records visible for this hostname. + ARecords []*string `json:"aRecords,omitempty"` + + // Alternate CName records visible for this hostname. + AlternateCNameRecords []*string `json:"alternateCNameRecords,omitempty"` + + // Alternate TXT records visible for this hostname. + AlternateTxtRecords []*string `json:"alternateTxtRecords,omitempty"` + + // CName records visible for this hostname. + CNameRecords []*string `json:"cNameRecords,omitempty"` + + // TXT records visible for this hostname. + TxtRecords []*string `json:"txtRecords,omitempty"` + + // READ-ONLY; Name of the conflicting Container App on the Managed Environment if it's within the same subscription. + ConflictingContainerAppResourceID *string `json:"conflictingContainerAppResourceId,omitempty" azure:"ro"` + + // READ-ONLY; Raw failure information if DNS verification fails. + CustomDomainVerificationFailureInfo *CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo `json:"customDomainVerificationFailureInfo,omitempty" azure:"ro"` + + // READ-ONLY; DNS verification test result. + CustomDomainVerificationTest *DNSVerificationTestResult `json:"customDomainVerificationTest,omitempty" azure:"ro"` + + // READ-ONLY; true if there is a conflict on the Container App's managed environment; otherwise, false. + HasConflictOnManagedEnvironment *bool `json:"hasConflictOnManagedEnvironment,omitempty" azure:"ro"` + + // READ-ONLY; Host name that was analyzed + HostName *string `json:"hostName,omitempty" azure:"ro"` + + // READ-ONLY; true if hostname is already verified; otherwise, false. + IsHostnameAlreadyVerified *bool `json:"isHostnameAlreadyVerified,omitempty" azure:"ro"` +} + +// CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo - Raw failure information if DNS verification fails. +type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo struct { + // Details or the error + Details []*CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem `json:"details,omitempty"` + + // READ-ONLY; Standardized string to programmatically identify the error. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Detailed error description and debugging information. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Detailed error description and debugging information. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem - Detailed errors. +type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem struct { + // READ-ONLY; Standardized string to programmatically identify the error. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Detailed error description and debugging information. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Detailed error description and debugging information. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// CustomOpenIDConnectProvider - The configuration settings of the custom Open ID Connect provider. +type CustomOpenIDConnectProvider struct { + // false if the custom Open ID provider provider should not be enabled; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + + // The configuration settings of the login flow of the custom Open ID Connect provider. + Login *OpenIDConnectLogin `json:"login,omitempty"` + + // The configuration settings of the app registration for the custom Open ID Connect provider. + Registration *OpenIDConnectRegistration `json:"registration,omitempty"` +} + +// CustomScaleRule - Container App container Custom scaling rule. +type CustomScaleRule struct { + // Authentication secrets for the custom scale rule. + Auth []*ScaleRuleAuth `json:"auth,omitempty"` + + // Metadata properties to describe custom scale rule. + Metadata map[string]*string `json:"metadata,omitempty"` + + // Type of the custom scale rule eg: azure-servicebus, redis etc. + Type *string `json:"type,omitempty"` +} + +// Dapr - Container App Dapr configuration. +type Dapr struct { + // Dapr application identifier + AppID *string `json:"appId,omitempty"` + + // Tells Dapr which port your application is listening on + AppPort *int32 `json:"appPort,omitempty"` + + // Tells Dapr which protocol your application is using. Valid options are http and grpc. Default is http + AppProtocol *AppProtocol `json:"appProtocol,omitempty"` + + // Enables API logging for the Dapr sidecar + EnableAPILogging *bool `json:"enableApiLogging,omitempty"` + + // Boolean indicating if the Dapr side car is enabled + Enabled *bool `json:"enabled,omitempty"` + + // Increasing max size of request body http and grpc servers parameter in MB to handle uploading of big files. Default is + // 4 MB. + HTTPMaxRequestSize *int32 `json:"httpMaxRequestSize,omitempty"` + + // Dapr max size of http header read buffer in KB to handle when sending multi-KB headers. Default is 65KB. + HTTPReadBufferSize *int32 `json:"httpReadBufferSize,omitempty"` + + // Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. + LogLevel *LogLevel `json:"logLevel,omitempty"` +} + +// DaprComponent - Dapr Component. +type DaprComponent struct { + // Dapr Component resource specific properties + Properties *DaprComponentProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DaprComponentProperties - Dapr Component resource specific properties +type DaprComponentProperties struct { + // Component type + ComponentType *string `json:"componentType,omitempty"` + + // Boolean describing if the component errors are ignores + IgnoreErrors *bool `json:"ignoreErrors,omitempty"` + + // Initialization timeout + InitTimeout *string `json:"initTimeout,omitempty"` + + // Component metadata + Metadata []*DaprMetadata `json:"metadata,omitempty"` + + // Names of container apps that can use this Dapr component + Scopes []*string `json:"scopes,omitempty"` + + // Name of a Dapr component to retrieve component secrets from + SecretStoreComponent *string `json:"secretStoreComponent,omitempty"` + + // Collection of secrets used by a Dapr component + Secrets []*Secret `json:"secrets,omitempty"` + + // Component version + Version *string `json:"version,omitempty"` +} + +// DaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the DaprComponentsClient.CreateOrUpdate +// method. +type DaprComponentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DaprComponentsClientDeleteOptions contains the optional parameters for the DaprComponentsClient.Delete method. +type DaprComponentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DaprComponentsClientGetOptions contains the optional parameters for the DaprComponentsClient.Get method. +type DaprComponentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DaprComponentsClientListOptions contains the optional parameters for the DaprComponentsClient.List method. +type DaprComponentsClientListOptions struct { + // placeholder for future optional parameters +} + +// DaprComponentsClientListSecretsOptions contains the optional parameters for the DaprComponentsClient.ListSecrets method. +type DaprComponentsClientListSecretsOptions struct { + // placeholder for future optional parameters +} + +// DaprComponentsCollection - Dapr Components ARM resource. +type DaprComponentsCollection struct { + // REQUIRED; Collection of resources. + Value []*DaprComponent `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// DaprMetadata - Dapr component metadata. +type DaprMetadata struct { + // Metadata property name. + Name *string `json:"name,omitempty"` + + // Name of the Dapr Component secret from which to pull the metadata property value. + SecretRef *string `json:"secretRef,omitempty"` + + // Metadata property value. + Value *string `json:"value,omitempty"` +} + +// DaprSecretsCollection - Dapr component Secrets Collection ARM resource. +type DaprSecretsCollection struct { + // REQUIRED; Collection of secrets used by a Dapr component + Value []*Secret `json:"value,omitempty"` +} + +// DefaultAuthorizationPolicy - The configuration settings of the Azure Active Directory default authorization policy. +type DefaultAuthorizationPolicy struct { + // The configuration settings of the Azure Active Directory allowed applications. + AllowedApplications []*string `json:"allowedApplications,omitempty"` + + // The configuration settings of the Azure Active Directory allowed principals. + AllowedPrincipals *AllowedPrincipals `json:"allowedPrincipals,omitempty"` +} + +// DefaultErrorResponse - App Service error response. +type DefaultErrorResponse struct { + // READ-ONLY; Error model. + Error *DefaultErrorResponseError `json:"error,omitempty" azure:"ro"` +} + +// DefaultErrorResponseError - Error model. +type DefaultErrorResponseError struct { + // Details or the error + Details []*DefaultErrorResponseErrorDetailsItem `json:"details,omitempty"` + + // READ-ONLY; Standardized string to programmatically identify the error. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; More information to debug error. + Innererror *string `json:"innererror,omitempty" azure:"ro"` + + // READ-ONLY; Detailed error description and debugging information. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Detailed error description and debugging information. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// DefaultErrorResponseErrorDetailsItem - Detailed errors. +type DefaultErrorResponseErrorDetailsItem struct { + // READ-ONLY; Standardized string to programmatically identify the error. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Detailed error description and debugging information. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Detailed error description and debugging information. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// DiagnosticDataProviderMetadata - Details of a diagnostics data provider +type DiagnosticDataProviderMetadata struct { + // Collection of properties + PropertyBag []*DiagnosticDataProviderMetadataPropertyBagItem `json:"propertyBag,omitempty"` + + // Name of data provider + ProviderName *string `json:"providerName,omitempty"` +} + +// DiagnosticDataProviderMetadataPropertyBagItem - Property details +type DiagnosticDataProviderMetadataPropertyBagItem struct { + // Property name + Name *string `json:"name,omitempty"` + + // Property value + Value *string `json:"value,omitempty"` +} + +// DiagnosticDataTableResponseColumn - Diagnostics data column +type DiagnosticDataTableResponseColumn struct { + // Column name + ColumnName *string `json:"columnName,omitempty"` + + // Column type + ColumnType *string `json:"columnType,omitempty"` + + // Data type of the column + DataType *string `json:"dataType,omitempty"` +} + +// DiagnosticDataTableResponseObject - Diagnostics data table +type DiagnosticDataTableResponseObject struct { + // Columns in the table + Columns []*DiagnosticDataTableResponseColumn `json:"columns,omitempty"` + + // Rows in the table + Rows []interface{} `json:"rows,omitempty"` + + // Table name + TableName *string `json:"tableName,omitempty"` +} + +// DiagnosticRendering - Rendering details of a diagnostics table +type DiagnosticRendering struct { + // Description of the table + Description *string `json:"description,omitempty"` + + // Flag if the table should be rendered + IsVisible *bool `json:"isVisible,omitempty"` + + // Title of the table + Title *string `json:"title,omitempty"` + + // Rendering type + Type *int32 `json:"type,omitempty"` +} + +// DiagnosticSupportTopic - Support topic information +type DiagnosticSupportTopic struct { + // READ-ONLY; Unique topic identifier + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; PES identifier + PesID *string `json:"pesId,omitempty" azure:"ro"` +} + +// Diagnostics data for a resource. +type Diagnostics struct { + // Diagnostics resource specific properties + Properties *DiagnosticsProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DiagnosticsCollection - Diagnostics data collection for a resource. +type DiagnosticsCollection struct { + // REQUIRED; Collection of diagnostic data. + Value []*Diagnostics `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// DiagnosticsDataAPIResponse - Diagnostics data returned from a detector +type DiagnosticsDataAPIResponse struct { + // Details of the table response + RenderingProperties *DiagnosticRendering `json:"renderingProperties,omitempty"` + + // Table response + Table *DiagnosticDataTableResponseObject `json:"table,omitempty"` +} + +// DiagnosticsDefinition - Metadata of the diagnostics response +type DiagnosticsDefinition struct { + // List of analysis types + AnalysisTypes []*string `json:"analysisTypes,omitempty"` + + // List of support topics + SupportTopicList []*DiagnosticSupportTopic `json:"supportTopicList,omitempty"` + + // READ-ONLY; Authors' names of the detector + Author *string `json:"author,omitempty" azure:"ro"` + + // READ-ONLY; Category of the detector + Category *string `json:"category,omitempty" azure:"ro"` + + // READ-ONLY; Details of the diagnostics info + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Unique detector name + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Display Name of the detector + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Authors' names of the detector + Score *float32 `json:"score,omitempty" azure:"ro"` + + // READ-ONLY; Authors' names of the detector + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DiagnosticsProperties - Diagnostics resource specific properties +type DiagnosticsProperties struct { + // List of data providers' metadata. + DataProviderMetadata *DiagnosticDataProviderMetadata `json:"dataProviderMetadata,omitempty"` + + // Set of data collections associated with the response. + Dataset []*DiagnosticsDataAPIResponse `json:"dataset,omitempty"` + + // Metadata of the diagnostics response. + Metadata *DiagnosticsDefinition `json:"metadata,omitempty"` + + // Status of the diagnostics response. + Status *DiagnosticsStatus `json:"status,omitempty"` +} + +// DiagnosticsStatus - Rendering details of a diagnostics table +type DiagnosticsStatus struct { + // Diagnostic message + Message *string `json:"message,omitempty"` + + // Status + StatusID *int32 `json:"statusId,omitempty"` +} + +// EnvironmentSKUProperties - Managed Environment resource SKU properties. +type EnvironmentSKUProperties struct { + // REQUIRED; Name of the Sku. + Name *SKUName `json:"name,omitempty"` +} + +// EnvironmentVar - Container App container environment variable. +type EnvironmentVar struct { + // Environment variable name. + Name *string `json:"name,omitempty"` + + // Name of the Container App secret from which to pull the environment variable value. + SecretRef *string `json:"secretRef,omitempty"` + + // Non-secret environment variable value. + Value *string `json:"value,omitempty"` +} + +// ExtendedLocation - The complex type of the extended location. +type ExtendedLocation struct { + // The name of the extended location. + Name *string `json:"name,omitempty"` + + // The type of the extended location. + Type *ExtendedLocationTypes `json:"type,omitempty"` +} + +// Facebook - The configuration settings of the Facebook provider. +type Facebook struct { + // false if the Facebook provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + + // The version of the Facebook api to be used while logging in. + GraphAPIVersion *string `json:"graphApiVersion,omitempty"` + + // The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` + + // The configuration settings of the app registration for the Facebook provider. + Registration *Registration `json:"registration,omitempty"` +} + +// ForwardProxy - The configuration settings of a forward proxy used to make the requests. +type ForwardProxy struct { + // The convention used to determine the url of the request made. + Convention *ForwardProxyConvention `json:"convention,omitempty"` + + // The name of the header containing the host of the request. + CustomHostHeaderName *string `json:"customHostHeaderName,omitempty"` + + // The name of the header containing the scheme of the request. + CustomProtoHeaderName *string `json:"customProtoHeaderName,omitempty"` +} + +// GitHub - The configuration settings of the GitHub provider. +type GitHub struct { + // false if the GitHub provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + + // The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` + + // The configuration settings of the app registration for the GitHub provider. + Registration *ClientRegistration `json:"registration,omitempty"` +} + +// GithubActionConfiguration - Configuration properties that define the mutable settings of a Container App SourceControl +type GithubActionConfiguration struct { + // AzureCredentials configurations. + AzureCredentials *AzureCredentials `json:"azureCredentials,omitempty"` + + // Context path + ContextPath *string `json:"contextPath,omitempty"` + + // Image name + Image *string `json:"image,omitempty"` + + // Operation system + OS *string `json:"os,omitempty"` + + // Code or Image + PublishType *string `json:"publishType,omitempty"` + + // Registry configurations. + RegistryInfo *RegistryInfo `json:"registryInfo,omitempty"` + + // Runtime stack + RuntimeStack *string `json:"runtimeStack,omitempty"` + + // Runtime version + RuntimeVersion *string `json:"runtimeVersion,omitempty"` +} + +// GlobalValidation - The configuration settings that determines the validation flow of users using ContainerApp Service Authentication/Authorization. +type GlobalValidation struct { + // The paths for which unauthenticated flow would not be redirected to the login page. + ExcludedPaths []*string `json:"excludedPaths,omitempty"` + + // The default authentication provider to use when multiple providers are configured. This setting is only needed if multiple + // providers are configured and the unauthenticated client action is set to + // "RedirectToLoginPage". + RedirectToProvider *string `json:"redirectToProvider,omitempty"` + + // The action to take when an unauthenticated client attempts to access the app. + UnauthenticatedClientAction *UnauthenticatedClientActionV2 `json:"unauthenticatedClientAction,omitempty"` +} + +// Google - The configuration settings of the Google provider. +type Google struct { + // false if the Google provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + + // The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` + + // The configuration settings of the app registration for the Google provider. + Registration *ClientRegistration `json:"registration,omitempty"` + + // The configuration settings of the Azure Active Directory token validation flow. + Validation *AllowedAudiencesValidation `json:"validation,omitempty"` +} + +// HTTPScaleRule - Container App container Http scaling rule. +type HTTPScaleRule struct { + // Authentication secrets for the custom scale rule. + Auth []*ScaleRuleAuth `json:"auth,omitempty"` + + // Metadata properties to describe http scale rule. + Metadata map[string]*string `json:"metadata,omitempty"` +} + +// HTTPSettings - The configuration settings of the HTTP requests for authentication and authorization requests made against +// ContainerApp Service Authentication/Authorization. +type HTTPSettings struct { + // The configuration settings of a forward proxy used to make the requests. + ForwardProxy *ForwardProxy `json:"forwardProxy,omitempty"` + + // false if the authentication/authorization responses not having the HTTPS scheme are permissible; otherwise, true. + RequireHTTPS *bool `json:"requireHttps,omitempty"` + + // The configuration settings of the paths HTTP requests. + Routes *HTTPSettingsRoutes `json:"routes,omitempty"` +} + +// HTTPSettingsRoutes - The configuration settings of the paths HTTP requests. +type HTTPSettingsRoutes struct { + // The prefix that should precede all the authentication/authorization paths. + APIPrefix *string `json:"apiPrefix,omitempty"` +} + +// IPSecurityRestrictionRule - Rule to restrict incoming IP address. +type IPSecurityRestrictionRule struct { + // REQUIRED; Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of ALL Allow or ALL Deny + Action *Action `json:"action,omitempty"` + + // REQUIRED; CIDR notation to match incoming IP address + IPAddressRange *string `json:"ipAddressRange,omitempty"` + + // REQUIRED; Name for the IP restriction rule. + Name *string `json:"name,omitempty"` + + // Describe the IP restriction rule that is being sent to the container-app. This is an optional field. + Description *string `json:"description,omitempty"` +} + +// IdentityProviders - The configuration settings of each of the identity providers used to configure ContainerApp Service +// Authentication/Authorization. +type IdentityProviders struct { + // The configuration settings of the Apple provider. + Apple *Apple `json:"apple,omitempty"` + + // The configuration settings of the Azure Active directory provider. + AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` + + // The configuration settings of the Azure Static Web Apps provider. + AzureStaticWebApps *AzureStaticWebApps `json:"azureStaticWebApps,omitempty"` + + // The map of the name of the alias of each custom Open ID Connect provider to the configuration settings of the custom Open + // ID Connect provider. + CustomOpenIDConnectProviders map[string]*CustomOpenIDConnectProvider `json:"customOpenIdConnectProviders,omitempty"` + + // The configuration settings of the Facebook provider. + Facebook *Facebook `json:"facebook,omitempty"` + + // The configuration settings of the GitHub provider. + GitHub *GitHub `json:"gitHub,omitempty"` + + // The configuration settings of the Google provider. + Google *Google `json:"google,omitempty"` + + // The configuration settings of the Twitter provider. + Twitter *Twitter `json:"twitter,omitempty"` +} + +// Ingress - Container App Ingress configuration. +type Ingress struct { + // Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS + // connections + AllowInsecure *bool `json:"allowInsecure,omitempty"` + + // custom domain bindings for Container Apps' hostnames. + CustomDomains []*CustomDomain `json:"customDomains,omitempty"` + + // Exposed Port in containers for TCP traffic from ingress + ExposedPort *int32 `json:"exposedPort,omitempty"` + + // Bool indicating if app exposes an external http endpoint + External *bool `json:"external,omitempty"` + + // Rules to restrict incoming IP address. + IPSecurityRestrictions []*IPSecurityRestrictionRule `json:"ipSecurityRestrictions,omitempty"` + + // Target Port in containers for traffic from ingress + TargetPort *int32 `json:"targetPort,omitempty"` + + // Traffic weights for app's revisions + Traffic []*TrafficWeight `json:"traffic,omitempty"` + + // Ingress transport protocol + Transport *IngressTransportMethod `json:"transport,omitempty"` + + // READ-ONLY; Hostname. + Fqdn *string `json:"fqdn,omitempty" azure:"ro"` +} + +// InitContainer - Container App init container definition +type InitContainer struct { + // Container start command arguments. + Args []*string `json:"args,omitempty"` + + // Container start command. + Command []*string `json:"command,omitempty"` + + // Container environment variables. + Env []*EnvironmentVar `json:"env,omitempty"` + + // Container image tag. + Image *string `json:"image,omitempty"` + + // Custom container name. + Name *string `json:"name,omitempty"` + + // Container resource requirements. + Resources *ContainerResources `json:"resources,omitempty"` + + // Container volume mounts. + VolumeMounts []*VolumeMount `json:"volumeMounts,omitempty"` +} + +// JwtClaimChecks - The configuration settings of the checks that should be made while validating the JWT Claims. +type JwtClaimChecks struct { + // The list of the allowed client applications. + AllowedClientApplications []*string `json:"allowedClientApplications,omitempty"` + + // The list of the allowed groups. + AllowedGroups []*string `json:"allowedGroups,omitempty"` +} + +// LogAnalyticsConfiguration - Log analytics configuration +type LogAnalyticsConfiguration struct { + // Log analytics customer id + CustomerID *string `json:"customerId,omitempty"` + + // Log analytics customer key + SharedKey *string `json:"sharedKey,omitempty"` +} + +// Login - The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. +type Login struct { + // External URLs that can be redirected to as part of logging in or logging out of the app. Note that the query string part + // of the URL is ignored. This is an advanced setting typically only needed by + // Windows Store application backends. Note that URLs within the current domain are always implicitly allowed. + AllowedExternalRedirectUrls []*string `json:"allowedExternalRedirectUrls,omitempty"` + + // The configuration settings of the session cookie's expiration. + CookieExpiration *CookieExpiration `json:"cookieExpiration,omitempty"` + + // The configuration settings of the nonce used in the login flow. + Nonce *Nonce `json:"nonce,omitempty"` + + // true if the fragments from the request are preserved after the login request is made; otherwise, false. + PreserveURLFragmentsForLogins *bool `json:"preserveUrlFragmentsForLogins,omitempty"` + + // The routes that specify the endpoints used for login and logout requests. + Routes *LoginRoutes `json:"routes,omitempty"` +} + +// LoginRoutes - The routes that specify the endpoints used for login and logout requests. +type LoginRoutes struct { + // The endpoint at which a logout request should be made. + LogoutEndpoint *string `json:"logoutEndpoint,omitempty"` +} + +// LoginScopes - The configuration settings of the login flow, including the scopes that should be requested. +type LoginScopes struct { + // A list of the scopes that should be requested while authenticating. + Scopes []*string `json:"scopes,omitempty"` +} + +// LogsConfiguration - Configuration of application logs +type LogsConfiguration struct { + // Logs destination + Destination *string `json:"destination,omitempty"` + + // Log Analytics configuration + LogAnalyticsConfiguration *LogAnalyticsConfiguration `json:"logAnalyticsConfiguration,omitempty"` +} + +// ManagedEnvironment - An environment for hosting container apps +type ManagedEnvironment struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Managed environment resource specific properties + Properties *ManagedEnvironmentProperties `json:"properties,omitempty"` + + // SKU properties of the Environment. + SKU *EnvironmentSKUProperties `json:"sku,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ManagedEnvironmentDiagnosticsClientGetDetectorOptions contains the optional parameters for the ManagedEnvironmentDiagnosticsClient.GetDetector +// method. +type ManagedEnvironmentDiagnosticsClientGetDetectorOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentDiagnosticsClientListDetectorsOptions contains the optional parameters for the ManagedEnvironmentDiagnosticsClient.ListDetectors +// method. +type ManagedEnvironmentDiagnosticsClientListDetectorsOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentProperties - Managed environment resource specific properties +type ManagedEnvironmentProperties struct { + // Cluster configuration which enables the log daemon to export app logs to a destination. Currently only "log-analytics" + // is supported + AppLogsConfiguration *LogsConfiguration `json:"appLogsConfiguration,omitempty"` + + // Custom domain configuration for the environment + CustomDomainConfiguration *CustomDomainConfiguration `json:"customDomainConfiguration,omitempty"` + + // Application Insights connection string used by Dapr to export Service to Service communication telemetry + DaprAIConnectionString *string `json:"daprAIConnectionString,omitempty"` + + // Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry + DaprAIInstrumentationKey *string `json:"daprAIInstrumentationKey,omitempty"` + + // Vnet configuration for the environment + VnetConfiguration *VnetConfiguration `json:"vnetConfiguration,omitempty"` + + // Workload profiles configured for the Managed Environment. + WorkloadProfiles []*WorkloadProfile `json:"workloadProfiles,omitempty"` + + // Whether or not this Managed Environment is zone-redundant. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + + // READ-ONLY; Default Domain Name for the cluster + DefaultDomain *string `json:"defaultDomain,omitempty" azure:"ro"` + + // READ-ONLY; Any errors that occurred during deployment or deployment validation + DeploymentErrors *string `json:"deploymentErrors,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the Environment. + ProvisioningState *EnvironmentProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Static IP of the Environment + StaticIP *string `json:"staticIp,omitempty" azure:"ro"` +} + +// ManagedEnvironmentStorage - Storage resource for managedEnvironment. +type ManagedEnvironmentStorage struct { + // Storage properties + Properties *ManagedEnvironmentStorageProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ManagedEnvironmentStorageProperties - Storage properties +type ManagedEnvironmentStorageProperties struct { + // Azure file properties + AzureFile *AzureFileProperties `json:"azureFile,omitempty"` +} + +// ManagedEnvironmentStoragesCollection - Collection of Storage for Environments +type ManagedEnvironmentStoragesCollection struct { + // REQUIRED; Collection of storage resources. + Value []*ManagedEnvironmentStorage `json:"value,omitempty"` +} + +// ManagedEnvironmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginCreateOrUpdate +// method. +type ManagedEnvironmentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginDelete +// method. +type ManagedEnvironmentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedEnvironmentsClientBeginUpdateOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginUpdate +// method. +type ManagedEnvironmentsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedEnvironmentsClientGetOptions contains the optional parameters for the ManagedEnvironmentsClient.Get method. +type ManagedEnvironmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ManagedEnvironmentsClient.ListByResourceGroup +// method. +type ManagedEnvironmentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ManagedEnvironmentsClient.ListBySubscription +// method. +type ManagedEnvironmentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentsCollection - Collection of Environments +type ManagedEnvironmentsCollection struct { + // REQUIRED; Collection of resources. + Value []*ManagedEnvironment `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ManagedEnvironmentsDiagnosticsClientGetRootOptions contains the optional parameters for the ManagedEnvironmentsDiagnosticsClient.GetRoot +// method. +type ManagedEnvironmentsDiagnosticsClientGetRootOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentsStoragesClientCreateOrUpdateOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.CreateOrUpdate +// method. +type ManagedEnvironmentsStoragesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentsStoragesClientDeleteOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.Delete +// method. +type ManagedEnvironmentsStoragesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentsStoragesClientGetOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.Get +// method. +type ManagedEnvironmentsStoragesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentsStoragesClientListOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.List +// method. +type ManagedEnvironmentsStoragesClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType `json:"type,omitempty"` + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// NamespacesClientCheckNameAvailabilityOptions contains the optional parameters for the NamespacesClient.CheckNameAvailability +// method. +type NamespacesClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// Nonce - The configuration settings of the nonce used in the login flow. +type Nonce struct { + // The time after the request is made when the nonce should expire. + NonceExpirationInterval *string `json:"nonceExpirationInterval,omitempty"` + + // false if the nonce should not be validated while completing the login flow; otherwise, true. + ValidateNonce *bool `json:"validateNonce,omitempty"` +} + +// OpenIDConnectClientCredential - The authentication client credentials of the custom Open ID Connect provider. +type OpenIDConnectClientCredential struct { + // The app setting that contains the client secret for the custom Open ID Connect provider. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` + + // The method that should be used to authenticate the user. + Method *string `json:"method,omitempty"` +} + +// OpenIDConnectConfig - The configuration settings of the endpoints used for the custom Open ID Connect provider. +type OpenIDConnectConfig struct { + // The endpoint to be used to make an authorization request. + AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` + + // The endpoint that provides the keys necessary to validate the token. + CertificationURI *string `json:"certificationUri,omitempty"` + + // The endpoint that issues the token. + Issuer *string `json:"issuer,omitempty"` + + // The endpoint to be used to request a token. + TokenEndpoint *string `json:"tokenEndpoint,omitempty"` + + // The endpoint that contains all the configuration endpoints for the provider. + WellKnownOpenIDConfiguration *string `json:"wellKnownOpenIdConfiguration,omitempty"` +} + +// OpenIDConnectLogin - The configuration settings of the login flow of the custom Open ID Connect provider. +type OpenIDConnectLogin struct { + // The name of the claim that contains the users name. + NameClaimType *string `json:"nameClaimType,omitempty"` + + // A list of the scopes that should be requested while authenticating. + Scopes []*string `json:"scopes,omitempty"` +} + +// OpenIDConnectRegistration - The configuration settings of the app registration for the custom Open ID Connect provider. +type OpenIDConnectRegistration struct { + // The authentication credentials of the custom Open ID Connect provider. + ClientCredential *OpenIDConnectClientCredential `json:"clientCredential,omitempty"` + + // The client id of the custom Open ID Connect provider. + ClientID *string `json:"clientId,omitempty"` + + // The configuration settings of the endpoints used for the custom Open ID Connect provider. + OpenIDConnectConfiguration *OpenIDConnectConfig `json:"openIdConnectConfiguration,omitempty"` +} + +// OperationDetail - Operation detail payload +type OperationDetail struct { + // Display of the operation + Display *OperationDisplay `json:"display,omitempty"` + + // Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + + // Name of the operation + Name *string `json:"name,omitempty"` + + // Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// OperationDisplay - Operation display payload +type OperationDisplay struct { + // Localized friendly description for the operation + Description *string `json:"description,omitempty"` + + // Localized friendly name for the operation + Operation *string `json:"operation,omitempty"` + + // Resource provider of the operation + Provider *string `json:"provider,omitempty"` + + // Resource of the operation + Resource *string `json:"resource,omitempty"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// QueueScaleRule - Container App container Azure Queue based scaling rule. +type QueueScaleRule struct { + // Authentication secrets for the queue scale rule. + Auth []*ScaleRuleAuth `json:"auth,omitempty"` + + // Queue length. + QueueLength *int32 `json:"queueLength,omitempty"` + + // Queue name. + QueueName *string `json:"queueName,omitempty"` +} + +// Registration - The configuration settings of the app registration for providers that have app ids and app secrets +type Registration struct { + // The App ID of the app used for login. + AppID *string `json:"appId,omitempty"` + + // The app setting name that contains the app secret. + AppSecretSettingName *string `json:"appSecretSettingName,omitempty"` +} + +// RegistryCredentials - Container App Private Registry +type RegistryCredentials struct { + // A Managed Identity to use to authenticate with Azure Container Registry. For user-assigned identities, use the full user-assigned + // identity Resource ID. For system-assigned identities, use 'system' + Identity *string `json:"identity,omitempty"` + + // The name of the Secret that contains the registry login password + PasswordSecretRef *string `json:"passwordSecretRef,omitempty"` + + // Container Registry Server + Server *string `json:"server,omitempty"` + + // Container Registry Username + Username *string `json:"username,omitempty"` +} + +// RegistryInfo - Container App registry information. +type RegistryInfo struct { + // registry secret. + RegistryPassword *string `json:"registryPassword,omitempty"` + + // registry server Url. + RegistryURL *string `json:"registryUrl,omitempty"` + + // registry username. + RegistryUserName *string `json:"registryUserName,omitempty"` +} + +// Replica - Container App Revision Replica. +type Replica struct { + // Replica resource specific properties + Properties *ReplicaProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ReplicaCollection - Container App Revision Replicas collection ARM resource. +type ReplicaCollection struct { + // REQUIRED; Collection of resources. + Value []*Replica `json:"value,omitempty"` +} + +// ReplicaContainer - Container object under Container App Revision Replica. +type ReplicaContainer struct { + // The Id of the Container + ContainerID *string `json:"containerId,omitempty"` + + // The Name of the Container + Name *string `json:"name,omitempty"` + + // The container ready status + Ready *bool `json:"ready,omitempty"` + + // The container restart count + RestartCount *int32 `json:"restartCount,omitempty"` + + // The container start status + Started *bool `json:"started,omitempty"` +} + +// ReplicaProperties - Replica resource specific properties +type ReplicaProperties struct { + // The containers collection under a replica. + Containers []*ReplicaContainer `json:"containers,omitempty"` + + // READ-ONLY; Timestamp describing when the pod was created by controller + CreatedTime *time.Time `json:"createdTime,omitempty" azure:"ro"` +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// Revision - Container App Revision. +type Revision struct { + // Revision resource specific properties + Properties *RevisionProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RevisionCollection - Container App Revisions collection ARM resource. +type RevisionCollection struct { + // REQUIRED; Collection of resources. + Value []*Revision `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// RevisionProperties - Revision resource specific properties +type RevisionProperties struct { + // READ-ONLY; Boolean describing if the Revision is Active + Active *bool `json:"active,omitempty" azure:"ro"` + + // READ-ONLY; Timestamp describing when the revision was created by controller + CreatedTime *time.Time `json:"createdTime,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified domain name of the revision + Fqdn *string `json:"fqdn,omitempty" azure:"ro"` + + // READ-ONLY; Current health State of the revision + HealthState *RevisionHealthState `json:"healthState,omitempty" azure:"ro"` + + // READ-ONLY; Optional Field - Platform Error Message + ProvisioningError *string `json:"provisioningError,omitempty" azure:"ro"` + + // READ-ONLY; Current provisioning State of the revision + ProvisioningState *RevisionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Number of pods currently running for this revision + Replicas *int32 `json:"replicas,omitempty" azure:"ro"` + + // READ-ONLY; Container App Revision Template with all possible settings and the defaults if user did not provide them. The + // defaults are populated as they were at the creation time + Template *Template `json:"template,omitempty" azure:"ro"` + + // READ-ONLY; Traffic weight assigned to this revision + TrafficWeight *int32 `json:"trafficWeight,omitempty" azure:"ro"` +} + +// Scale - Container App scaling configurations. +type Scale struct { + // Optional. Maximum number of container replicas. Defaults to 10 if not set. + MaxReplicas *int32 `json:"maxReplicas,omitempty"` + + // Optional. Minimum number of container replicas. + MinReplicas *int32 `json:"minReplicas,omitempty"` + + // Scaling rules. + Rules []*ScaleRule `json:"rules,omitempty"` +} + +// ScaleRule - Container App container scaling rule. +type ScaleRule struct { + // Azure Queue based scaling. + AzureQueue *QueueScaleRule `json:"azureQueue,omitempty"` + + // Custom scale rule. + Custom *CustomScaleRule `json:"custom,omitempty"` + + // HTTP requests based scaling. + HTTP *HTTPScaleRule `json:"http,omitempty"` + + // Scale Rule Name + Name *string `json:"name,omitempty"` + + // Tcp requests based scaling. + TCP *TCPScaleRule `json:"tcp,omitempty"` +} + +// ScaleRuleAuth - Auth Secrets for Container App Scale Rule +type ScaleRuleAuth struct { + // Name of the Container App secret from which to pull the auth params. + SecretRef *string `json:"secretRef,omitempty"` + + // Trigger Parameter that uses the secret + TriggerParameter *string `json:"triggerParameter,omitempty"` +} + +// Secret definition. +type Secret struct { + // Secret Name. + Name *string `json:"name,omitempty"` + + // Secret Value. + Value *string `json:"value,omitempty"` +} + +// SecretsCollection - Container App Secrets Collection ARM resource. +type SecretsCollection struct { + // REQUIRED; Collection of resources. + Value []*ContainerAppSecret `json:"value,omitempty"` +} + +// SourceControl - Container App SourceControl. +type SourceControl struct { + // SourceControl resource specific properties + Properties *SourceControlProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SourceControlCollection - SourceControl collection ARM resource. +type SourceControlCollection struct { + // REQUIRED; Collection of resources. + Value []*SourceControl `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// SourceControlProperties - SourceControl resource specific properties +type SourceControlProperties struct { + // The branch which will trigger the auto deployment + Branch *string `json:"branch,omitempty"` + + // Container App Revision Template with all possible settings and the defaults if user did not provide them. The defaults + // are populated as they were at the creation time + GithubActionConfiguration *GithubActionConfiguration `json:"githubActionConfiguration,omitempty"` + + // The repo url which will be integrated to ContainerApp. + RepoURL *string `json:"repoUrl,omitempty"` + + // READ-ONLY; Current provisioning State of the operation + OperationState *SourceControlOperationState `json:"operationState,omitempty" azure:"ro"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// TCPScaleRule - Container App container Tcp scaling rule. +type TCPScaleRule struct { + // Authentication secrets for the tcp scale rule. + Auth []*ScaleRuleAuth `json:"auth,omitempty"` + + // Metadata properties to describe tcp scale rule. + Metadata map[string]*string `json:"metadata,omitempty"` +} + +// Template - Container App versioned application definition. Defines the desired state of an immutable revision. Any changes +// to this section Will result in a new revision being created +type Template struct { + // List of container definitions for the Container App. + Containers []*Container `json:"containers,omitempty"` + + // List of specialized containers that run before app containers. + InitContainers []*InitContainer `json:"initContainers,omitempty"` + + // User friendly suffix that is appended to the revision name + RevisionSuffix *string `json:"revisionSuffix,omitempty"` + + // Scaling properties for the Container App. + Scale *Scale `json:"scale,omitempty"` + + // List of volume definitions for the Container App. + Volumes []*Volume `json:"volumes,omitempty"` +} + +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// TrafficWeight - Traffic weight assigned to a revision +type TrafficWeight struct { + // Associates a traffic label with a revision + Label *string `json:"label,omitempty"` + + // Indicates that the traffic weight belongs to a latest stable revision + LatestRevision *bool `json:"latestRevision,omitempty"` + + // Name of a revision + RevisionName *string `json:"revisionName,omitempty"` + + // Traffic weight assigned to a revision + Weight *int32 `json:"weight,omitempty"` +} + +// Twitter - The configuration settings of the Twitter provider. +type Twitter struct { + // false if the Twitter provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + + // The configuration settings of the app registration for the Twitter provider. + Registration *TwitterRegistration `json:"registration,omitempty"` +} + +// TwitterRegistration - The configuration settings of the app registration for the Twitter provider. +type TwitterRegistration struct { + // The OAuth 1.0a consumer key of the Twitter application used for sign-in. This setting is required for enabling Twitter + // Sign-In. Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + ConsumerKey *string `json:"consumerKey,omitempty"` + + // The app setting name that contains the OAuth 1.0a consumer secret of the Twitter application used for sign-in. + ConsumerSecretSettingName *string `json:"consumerSecretSettingName,omitempty"` +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + +// VnetConfiguration - Configuration properties for apps environment to join a Virtual Network +type VnetConfiguration struct { + // CIDR notation IP range assigned to the Docker bridge, network. Must not overlap with any other provided IP ranges. + DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` + + // Resource ID of a subnet for infrastructure components. This subnet must be in the same VNET as the subnet defined in runtimeSubnetId. + // Must not overlap with any other provided IP ranges. + InfrastructureSubnetID *string `json:"infrastructureSubnetId,omitempty"` + + // Boolean indicating the environment only has an internal load balancer. These environments do not have a public static IP + // resource. They must provide runtimeSubnetId and infrastructureSubnetId if + // enabling this property + Internal *bool `json:"internal,omitempty"` + + // IP range in CIDR notation that can be reserved for environment infrastructure IP addresses. Must not overlap with any other + // provided IP ranges. + PlatformReservedCidr *string `json:"platformReservedCidr,omitempty"` + + // An IP address from the IP range defined by platformReservedCidr that will be reserved for the internal DNS server. + PlatformReservedDNSIP *string `json:"platformReservedDnsIP,omitempty"` + + // Resource ID of a subnet that Container App containers are injected into. This subnet must be in the same VNET as the subnet + // defined in infrastructureSubnetId. Must not overlap with any other provided + // IP ranges. + RuntimeSubnetID *string `json:"runtimeSubnetId,omitempty"` +} + +// Volume definitions for the Container App. +type Volume struct { + // Volume name. + Name *string `json:"name,omitempty"` + + // Name of storage resource. No need to provide for EmptyDir. + StorageName *string `json:"storageName,omitempty"` + + // Storage type for the volume. If not provided, use EmptyDir. + StorageType *StorageType `json:"storageType,omitempty"` +} + +// VolumeMount - Volume mount for the Container App. +type VolumeMount struct { + // Path within the container at which the volume should be mounted.Must not contain ':'. + MountPath *string `json:"mountPath,omitempty"` + + // This must match the Name of a Volume. + VolumeName *string `json:"volumeName,omitempty"` +} + +// WorkloadProfile - Workload profile to scope container app execution. +type WorkloadProfile struct { + // REQUIRED; The maximum capacity. + MaximumCount *int32 `json:"maximumCount,omitempty"` + + // REQUIRED; The minimum capacity. + MinimumCount *int32 `json:"minimumCount,omitempty"` + + // REQUIRED; Workload profile type for the workloads to run on. + WorkloadProfileType *string `json:"workloadProfileType,omitempty"` +} diff --git a/sdk/resourcemanager/app/armapp/models_serde.go b/sdk/resourcemanager/app/armapp/models_serde.go new file mode 100644 index 000000000000..6413b430f540 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/models_serde.go @@ -0,0 +1,5403 @@ +//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 armapp + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AllowedAudiencesValidation. +func (a AllowedAudiencesValidation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedAudiences", a.AllowedAudiences) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedAudiencesValidation. +func (a *AllowedAudiencesValidation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedAudiences": + err = unpopulate(val, "AllowedAudiences", &a.AllowedAudiences) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AllowedPrincipals. +func (a AllowedPrincipals) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groups", a.Groups) + populate(objectMap, "identities", a.Identities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedPrincipals. +func (a *AllowedPrincipals) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groups": + err = unpopulate(val, "Groups", &a.Groups) + delete(rawMsg, key) + case "identities": + err = unpopulate(val, "Identities", &a.Identities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Apple. +func (a Apple) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "login", a.Login) + populate(objectMap, "registration", a.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Apple. +func (a *Apple) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &a.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &a.Registration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AppleRegistration. +func (a AppleRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", a.ClientID) + populate(objectMap, "clientSecretSettingName", a.ClientSecretSettingName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppleRegistration. +func (a *AppleRegistration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + case "clientSecretSettingName": + err = unpopulate(val, "ClientSecretSettingName", &a.ClientSecretSettingName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthConfig. +func (a AuthConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthConfig. +func (a *AuthConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthConfigCollection. +func (a AuthConfigCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthConfigCollection. +func (a *AuthConfigCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthConfigProperties. +func (a AuthConfigProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "globalValidation", a.GlobalValidation) + populate(objectMap, "httpSettings", a.HTTPSettings) + populate(objectMap, "identityProviders", a.IdentityProviders) + populate(objectMap, "login", a.Login) + populate(objectMap, "platform", a.Platform) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthConfigProperties. +func (a *AuthConfigProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "globalValidation": + err = unpopulate(val, "GlobalValidation", &a.GlobalValidation) + delete(rawMsg, key) + case "httpSettings": + err = unpopulate(val, "HTTPSettings", &a.HTTPSettings) + delete(rawMsg, key) + case "identityProviders": + err = unpopulate(val, "IdentityProviders", &a.IdentityProviders) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &a.Login) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &a.Platform) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthPlatform. +func (a AuthPlatform) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "runtimeVersion", a.RuntimeVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthPlatform. +func (a *AuthPlatform) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "runtimeVersion": + err = unpopulate(val, "RuntimeVersion", &a.RuntimeVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableOperations. +func (a AvailableOperations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableOperations. +func (a *AvailableOperations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureActiveDirectory. +func (a AzureActiveDirectory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "isAutoProvisioned", a.IsAutoProvisioned) + populate(objectMap, "login", a.Login) + populate(objectMap, "registration", a.Registration) + populate(objectMap, "validation", a.Validation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureActiveDirectory. +func (a *AzureActiveDirectory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "isAutoProvisioned": + err = unpopulate(val, "IsAutoProvisioned", &a.IsAutoProvisioned) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &a.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &a.Registration) + delete(rawMsg, key) + case "validation": + err = unpopulate(val, "Validation", &a.Validation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureActiveDirectoryLogin. +func (a AzureActiveDirectoryLogin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disableWWWAuthenticate", a.DisableWWWAuthenticate) + populate(objectMap, "loginParameters", a.LoginParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureActiveDirectoryLogin. +func (a *AzureActiveDirectoryLogin) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "disableWWWAuthenticate": + err = unpopulate(val, "DisableWWWAuthenticate", &a.DisableWWWAuthenticate) + delete(rawMsg, key) + case "loginParameters": + err = unpopulate(val, "LoginParameters", &a.LoginParameters) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureActiveDirectoryRegistration. +func (a AzureActiveDirectoryRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", a.ClientID) + populate(objectMap, "clientSecretCertificateIssuer", a.ClientSecretCertificateIssuer) + populate(objectMap, "clientSecretCertificateSubjectAlternativeName", a.ClientSecretCertificateSubjectAlternativeName) + populate(objectMap, "clientSecretCertificateThumbprint", a.ClientSecretCertificateThumbprint) + populate(objectMap, "clientSecretSettingName", a.ClientSecretSettingName) + populate(objectMap, "openIdIssuer", a.OpenIDIssuer) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureActiveDirectoryRegistration. +func (a *AzureActiveDirectoryRegistration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + case "clientSecretCertificateIssuer": + err = unpopulate(val, "ClientSecretCertificateIssuer", &a.ClientSecretCertificateIssuer) + delete(rawMsg, key) + case "clientSecretCertificateSubjectAlternativeName": + err = unpopulate(val, "ClientSecretCertificateSubjectAlternativeName", &a.ClientSecretCertificateSubjectAlternativeName) + delete(rawMsg, key) + case "clientSecretCertificateThumbprint": + err = unpopulate(val, "ClientSecretCertificateThumbprint", &a.ClientSecretCertificateThumbprint) + delete(rawMsg, key) + case "clientSecretSettingName": + err = unpopulate(val, "ClientSecretSettingName", &a.ClientSecretSettingName) + delete(rawMsg, key) + case "openIdIssuer": + err = unpopulate(val, "OpenIDIssuer", &a.OpenIDIssuer) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureActiveDirectoryValidation. +func (a AzureActiveDirectoryValidation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedAudiences", a.AllowedAudiences) + populate(objectMap, "defaultAuthorizationPolicy", a.DefaultAuthorizationPolicy) + populate(objectMap, "jwtClaimChecks", a.JwtClaimChecks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureActiveDirectoryValidation. +func (a *AzureActiveDirectoryValidation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedAudiences": + err = unpopulate(val, "AllowedAudiences", &a.AllowedAudiences) + delete(rawMsg, key) + case "defaultAuthorizationPolicy": + err = unpopulate(val, "DefaultAuthorizationPolicy", &a.DefaultAuthorizationPolicy) + delete(rawMsg, key) + case "jwtClaimChecks": + err = unpopulate(val, "JwtClaimChecks", &a.JwtClaimChecks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureCredentials. +func (a AzureCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", a.ClientID) + populate(objectMap, "clientSecret", a.ClientSecret) + populate(objectMap, "subscriptionId", a.SubscriptionID) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureCredentials. +func (a *AzureCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &a.ClientSecret) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &a.SubscriptionID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFileProperties. +func (a AzureFileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessMode", a.AccessMode) + populate(objectMap, "accountKey", a.AccountKey) + populate(objectMap, "accountName", a.AccountName) + populate(objectMap, "shareName", a.ShareName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileProperties. +func (a *AzureFileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessMode": + err = unpopulate(val, "AccessMode", &a.AccessMode) + delete(rawMsg, key) + case "accountKey": + err = unpopulate(val, "AccountKey", &a.AccountKey) + delete(rawMsg, key) + case "accountName": + err = unpopulate(val, "AccountName", &a.AccountName) + delete(rawMsg, key) + case "shareName": + err = unpopulate(val, "ShareName", &a.ShareName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureStaticWebApps. +func (a AzureStaticWebApps) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "registration", a.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStaticWebApps. +func (a *AzureStaticWebApps) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &a.Registration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureStaticWebAppsRegistration. +func (a AzureStaticWebAppsRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", a.ClientID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStaticWebAppsRegistration. +func (a *AzureStaticWebAppsRegistration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseContainer. +func (b BaseContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "args", b.Args) + populate(objectMap, "command", b.Command) + populate(objectMap, "env", b.Env) + populate(objectMap, "image", b.Image) + populate(objectMap, "name", b.Name) + populate(objectMap, "resources", b.Resources) + populate(objectMap, "volumeMounts", b.VolumeMounts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseContainer. +func (b *BaseContainer) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "args": + err = unpopulate(val, "Args", &b.Args) + delete(rawMsg, key) + case "command": + err = unpopulate(val, "Command", &b.Command) + delete(rawMsg, key) + case "env": + err = unpopulate(val, "Env", &b.Env) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &b.Image) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &b.Resources) + delete(rawMsg, key) + case "volumeMounts": + err = unpopulate(val, "VolumeMounts", &b.VolumeMounts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Certificate. +func (c *Certificate) 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 "location": + err = unpopulate(val, "Location", &c.Location) + 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 "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 CertificateCollection. +func (c CertificateCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCollection. +func (c *CertificateCollection) 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 "value": + err = unpopulate(val, "Value", &c.Value) + 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 CertificatePatch. +func (c CertificatePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificatePatch. +func (c *CertificatePatch) 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 "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 CertificateProperties. +func (c CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) + populateTimeRFC3339(objectMap, "issueDate", c.IssueDate) + populate(objectMap, "issuer", c.Issuer) + populate(objectMap, "password", c.Password) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "publicKeyHash", c.PublicKeyHash) + populate(objectMap, "subjectAlternativeNames", c.SubjectAlternativeNames) + populate(objectMap, "subjectName", c.SubjectName) + populate(objectMap, "thumbprint", c.Thumbprint) + populate(objectMap, "valid", c.Valid) + populateByteArray(objectMap, "value", c.Value, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProperties. +func (c *CertificateProperties) 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 "expirationDate": + err = unpopulateTimeRFC3339(val, "ExpirationDate", &c.ExpirationDate) + delete(rawMsg, key) + case "issueDate": + err = unpopulateTimeRFC3339(val, "IssueDate", &c.IssueDate) + delete(rawMsg, key) + case "issuer": + err = unpopulate(val, "Issuer", &c.Issuer) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "publicKeyHash": + err = unpopulate(val, "PublicKeyHash", &c.PublicKeyHash) + delete(rawMsg, key) + case "subjectAlternativeNames": + err = unpopulate(val, "SubjectAlternativeNames", &c.SubjectAlternativeNames) + delete(rawMsg, key) + case "subjectName": + err = unpopulate(val, "SubjectName", &c.SubjectName) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + case "valid": + err = unpopulate(val, "Valid", &c.Valid) + delete(rawMsg, key) + case "value": + err = runtime.DecodeByteArray(string(val), &c.Value, runtime.Base64StdFormat) + 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 CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityRequest. +func (c *CheckNameAvailabilityRequest) 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 "name": + err = unpopulate(val, "Name", &c.Name) + 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 CheckNameAvailabilityResponse. +func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResponse. +func (c *CheckNameAvailabilityResponse) 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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 ClientRegistration. +func (c ClientRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", c.ClientID) + populate(objectMap, "clientSecretSettingName", c.ClientSecretSettingName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientRegistration. +func (c *ClientRegistration) 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 "clientId": + err = unpopulate(val, "ClientID", &c.ClientID) + delete(rawMsg, key) + case "clientSecretSettingName": + err = unpopulate(val, "ClientSecretSettingName", &c.ClientSecretSettingName) + 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 Configuration. +func (c Configuration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activeRevisionsMode", c.ActiveRevisionsMode) + populate(objectMap, "dapr", c.Dapr) + populate(objectMap, "ingress", c.Ingress) + populate(objectMap, "maxInactiveRevisions", c.MaxInactiveRevisions) + populate(objectMap, "registries", c.Registries) + populate(objectMap, "secrets", c.Secrets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Configuration. +func (c *Configuration) 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 "activeRevisionsMode": + err = unpopulate(val, "ActiveRevisionsMode", &c.ActiveRevisionsMode) + delete(rawMsg, key) + case "dapr": + err = unpopulate(val, "Dapr", &c.Dapr) + delete(rawMsg, key) + case "ingress": + err = unpopulate(val, "Ingress", &c.Ingress) + delete(rawMsg, key) + case "maxInactiveRevisions": + err = unpopulate(val, "MaxInactiveRevisions", &c.MaxInactiveRevisions) + delete(rawMsg, key) + case "registries": + err = unpopulate(val, "Registries", &c.Registries) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &c.Secrets) + 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 ConnectedEnvironment. +func (c ConnectedEnvironment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", c.ExtendedLocation) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironment. +func (c *ConnectedEnvironment) 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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &c.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentCollection. +func (c ConnectedEnvironmentCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentCollection. +func (c *ConnectedEnvironmentCollection) 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 "value": + err = unpopulate(val, "Value", &c.Value) + 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 ConnectedEnvironmentProperties. +func (c ConnectedEnvironmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "daprAIConnectionString", c.DaprAIConnectionString) + populate(objectMap, "defaultDomain", c.DefaultDomain) + populate(objectMap, "deploymentErrors", c.DeploymentErrors) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "staticIp", c.StaticIP) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentProperties. +func (c *ConnectedEnvironmentProperties) 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 "daprAIConnectionString": + err = unpopulate(val, "DaprAIConnectionString", &c.DaprAIConnectionString) + delete(rawMsg, key) + case "defaultDomain": + err = unpopulate(val, "DefaultDomain", &c.DefaultDomain) + delete(rawMsg, key) + case "deploymentErrors": + err = unpopulate(val, "DeploymentErrors", &c.DeploymentErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "staticIp": + err = unpopulate(val, "StaticIP", &c.StaticIP) + 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 ConnectedEnvironmentStorage. +func (c ConnectedEnvironmentStorage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 ConnectedEnvironmentStorage. +func (c *ConnectedEnvironmentStorage) 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 ConnectedEnvironmentStorageProperties. +func (c ConnectedEnvironmentStorageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureFile", c.AzureFile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentStorageProperties. +func (c *ConnectedEnvironmentStorageProperties) 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 "azureFile": + err = unpopulate(val, "AzureFile", &c.AzureFile) + 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 ConnectedEnvironmentStoragesCollection. +func (c ConnectedEnvironmentStoragesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentStoragesCollection. +func (c *ConnectedEnvironmentStoragesCollection) 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 "value": + err = unpopulate(val, "Value", &c.Value) + 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 Container. +func (c Container) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "args", c.Args) + populate(objectMap, "command", c.Command) + populate(objectMap, "env", c.Env) + populate(objectMap, "image", c.Image) + populate(objectMap, "name", c.Name) + populate(objectMap, "probes", c.Probes) + populate(objectMap, "resources", c.Resources) + populate(objectMap, "volumeMounts", c.VolumeMounts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Container. +func (c *Container) 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 "args": + err = unpopulate(val, "Args", &c.Args) + delete(rawMsg, key) + case "command": + err = unpopulate(val, "Command", &c.Command) + delete(rawMsg, key) + case "env": + err = unpopulate(val, "Env", &c.Env) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &c.Image) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "probes": + err = unpopulate(val, "Probes", &c.Probes) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &c.Resources) + delete(rawMsg, key) + case "volumeMounts": + err = unpopulate(val, "VolumeMounts", &c.VolumeMounts) + 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 ContainerApp. +func (c ContainerApp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", c.ExtendedLocation) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerApp. +func (c *ContainerApp) 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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &c.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerAppCollection. +func (c ContainerAppCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppCollection. +func (c *ContainerAppCollection) 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 "value": + err = unpopulate(val, "Value", &c.Value) + 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 ContainerAppProbe. +func (c ContainerAppProbe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "failureThreshold", c.FailureThreshold) + populate(objectMap, "httpGet", c.HTTPGet) + populate(objectMap, "initialDelaySeconds", c.InitialDelaySeconds) + populate(objectMap, "periodSeconds", c.PeriodSeconds) + populate(objectMap, "successThreshold", c.SuccessThreshold) + populate(objectMap, "tcpSocket", c.TCPSocket) + populate(objectMap, "terminationGracePeriodSeconds", c.TerminationGracePeriodSeconds) + populate(objectMap, "timeoutSeconds", c.TimeoutSeconds) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbe. +func (c *ContainerAppProbe) 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 "failureThreshold": + err = unpopulate(val, "FailureThreshold", &c.FailureThreshold) + delete(rawMsg, key) + case "httpGet": + err = unpopulate(val, "HTTPGet", &c.HTTPGet) + delete(rawMsg, key) + case "initialDelaySeconds": + err = unpopulate(val, "InitialDelaySeconds", &c.InitialDelaySeconds) + delete(rawMsg, key) + case "periodSeconds": + err = unpopulate(val, "PeriodSeconds", &c.PeriodSeconds) + delete(rawMsg, key) + case "successThreshold": + err = unpopulate(val, "SuccessThreshold", &c.SuccessThreshold) + delete(rawMsg, key) + case "tcpSocket": + err = unpopulate(val, "TCPSocket", &c.TCPSocket) + delete(rawMsg, key) + case "terminationGracePeriodSeconds": + err = unpopulate(val, "TerminationGracePeriodSeconds", &c.TerminationGracePeriodSeconds) + delete(rawMsg, key) + case "timeoutSeconds": + err = unpopulate(val, "TimeoutSeconds", &c.TimeoutSeconds) + 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 ContainerAppProbeHTTPGet. +func (c ContainerAppProbeHTTPGet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "httpHeaders", c.HTTPHeaders) + populate(objectMap, "host", c.Host) + populate(objectMap, "path", c.Path) + populate(objectMap, "port", c.Port) + populate(objectMap, "scheme", c.Scheme) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeHTTPGet. +func (c *ContainerAppProbeHTTPGet) 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 "httpHeaders": + err = unpopulate(val, "HTTPHeaders", &c.HTTPHeaders) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &c.Host) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &c.Path) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + case "scheme": + err = unpopulate(val, "Scheme", &c.Scheme) + 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 ContainerAppProbeHTTPGetHTTPHeadersItem. +func (c ContainerAppProbeHTTPGetHTTPHeadersItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeHTTPGetHTTPHeadersItem. +func (c *ContainerAppProbeHTTPGetHTTPHeadersItem) 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 "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + 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 ContainerAppProbeTCPSocket. +func (c ContainerAppProbeTCPSocket) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "host", c.Host) + populate(objectMap, "port", c.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeTCPSocket. +func (c *ContainerAppProbeTCPSocket) 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 "host": + err = unpopulate(val, "Host", &c.Host) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) + 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 ContainerAppProperties. +func (c ContainerAppProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", c.Configuration) + populate(objectMap, "customDomainVerificationId", c.CustomDomainVerificationID) + populate(objectMap, "environmentId", c.EnvironmentID) + populate(objectMap, "latestRevisionFqdn", c.LatestRevisionFqdn) + populate(objectMap, "latestRevisionName", c.LatestRevisionName) + populate(objectMap, "managedEnvironmentId", c.ManagedEnvironmentID) + populate(objectMap, "outboundIPAddresses", c.OutboundIPAddresses) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "template", c.Template) + populate(objectMap, "workloadProfileType", c.WorkloadProfileType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProperties. +func (c *ContainerAppProperties) 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 "configuration": + err = unpopulate(val, "Configuration", &c.Configuration) + delete(rawMsg, key) + case "customDomainVerificationId": + err = unpopulate(val, "CustomDomainVerificationID", &c.CustomDomainVerificationID) + delete(rawMsg, key) + case "environmentId": + err = unpopulate(val, "EnvironmentID", &c.EnvironmentID) + delete(rawMsg, key) + case "latestRevisionFqdn": + err = unpopulate(val, "LatestRevisionFqdn", &c.LatestRevisionFqdn) + delete(rawMsg, key) + case "latestRevisionName": + err = unpopulate(val, "LatestRevisionName", &c.LatestRevisionName) + delete(rawMsg, key) + case "managedEnvironmentId": + err = unpopulate(val, "ManagedEnvironmentID", &c.ManagedEnvironmentID) + delete(rawMsg, key) + case "outboundIPAddresses": + err = unpopulate(val, "OutboundIPAddresses", &c.OutboundIPAddresses) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &c.Template) + delete(rawMsg, key) + case "workloadProfileType": + err = unpopulate(val, "WorkloadProfileType", &c.WorkloadProfileType) + 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 ContainerAppSecret. +func (c ContainerAppSecret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppSecret. +func (c *ContainerAppSecret) 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 "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + 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 ContainerResources. +func (c ContainerResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cpu", c.CPU) + populate(objectMap, "ephemeralStorage", c.EphemeralStorage) + populate(objectMap, "memory", c.Memory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerResources. +func (c *ContainerResources) 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 "cpu": + err = unpopulate(val, "CPU", &c.CPU) + delete(rawMsg, key) + case "ephemeralStorage": + err = unpopulate(val, "EphemeralStorage", &c.EphemeralStorage) + delete(rawMsg, key) + case "memory": + err = unpopulate(val, "Memory", &c.Memory) + 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 CookieExpiration. +func (c CookieExpiration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "convention", c.Convention) + populate(objectMap, "timeToExpiration", c.TimeToExpiration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CookieExpiration. +func (c *CookieExpiration) 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 "convention": + err = unpopulate(val, "Convention", &c.Convention) + delete(rawMsg, key) + case "timeToExpiration": + err = unpopulate(val, "TimeToExpiration", &c.TimeToExpiration) + 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 CustomDomain. +func (c CustomDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bindingType", c.BindingType) + populate(objectMap, "certificateId", c.CertificateID) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDomain. +func (c *CustomDomain) 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 "bindingType": + err = unpopulate(val, "BindingType", &c.BindingType) + delete(rawMsg, key) + case "certificateId": + err = unpopulate(val, "CertificateID", &c.CertificateID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + 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 CustomDomainConfiguration. +func (c CustomDomainConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateByteArray(objectMap, "certificatePassword", c.CertificatePassword, runtime.Base64StdFormat) + populateByteArray(objectMap, "certificateValue", c.CertificateValue, runtime.Base64StdFormat) + populate(objectMap, "customDomainVerificationId", c.CustomDomainVerificationID) + populate(objectMap, "dnsSuffix", c.DNSSuffix) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) + populate(objectMap, "subjectName", c.SubjectName) + populate(objectMap, "thumbprint", c.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDomainConfiguration. +func (c *CustomDomainConfiguration) 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 "certificatePassword": + err = runtime.DecodeByteArray(string(val), &c.CertificatePassword, runtime.Base64StdFormat) + delete(rawMsg, key) + case "certificateValue": + err = runtime.DecodeByteArray(string(val), &c.CertificateValue, runtime.Base64StdFormat) + delete(rawMsg, key) + case "customDomainVerificationId": + err = unpopulate(val, "CustomDomainVerificationID", &c.CustomDomainVerificationID) + delete(rawMsg, key) + case "dnsSuffix": + err = unpopulate(val, "DNSSuffix", &c.DNSSuffix) + delete(rawMsg, key) + case "expirationDate": + err = unpopulateTimeRFC3339(val, "ExpirationDate", &c.ExpirationDate) + delete(rawMsg, key) + case "subjectName": + err = unpopulate(val, "SubjectName", &c.SubjectName) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + 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 CustomHostnameAnalysisResult. +func (c CustomHostnameAnalysisResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aRecords", c.ARecords) + populate(objectMap, "alternateCNameRecords", c.AlternateCNameRecords) + populate(objectMap, "alternateTxtRecords", c.AlternateTxtRecords) + populate(objectMap, "cNameRecords", c.CNameRecords) + populate(objectMap, "conflictingContainerAppResourceId", c.ConflictingContainerAppResourceID) + populate(objectMap, "customDomainVerificationFailureInfo", c.CustomDomainVerificationFailureInfo) + populate(objectMap, "customDomainVerificationTest", c.CustomDomainVerificationTest) + populate(objectMap, "hasConflictOnManagedEnvironment", c.HasConflictOnManagedEnvironment) + populate(objectMap, "hostName", c.HostName) + populate(objectMap, "isHostnameAlreadyVerified", c.IsHostnameAlreadyVerified) + populate(objectMap, "txtRecords", c.TxtRecords) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHostnameAnalysisResult. +func (c *CustomHostnameAnalysisResult) 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 "aRecords": + err = unpopulate(val, "ARecords", &c.ARecords) + delete(rawMsg, key) + case "alternateCNameRecords": + err = unpopulate(val, "AlternateCNameRecords", &c.AlternateCNameRecords) + delete(rawMsg, key) + case "alternateTxtRecords": + err = unpopulate(val, "AlternateTxtRecords", &c.AlternateTxtRecords) + delete(rawMsg, key) + case "cNameRecords": + err = unpopulate(val, "CNameRecords", &c.CNameRecords) + delete(rawMsg, key) + case "conflictingContainerAppResourceId": + err = unpopulate(val, "ConflictingContainerAppResourceID", &c.ConflictingContainerAppResourceID) + delete(rawMsg, key) + case "customDomainVerificationFailureInfo": + err = unpopulate(val, "CustomDomainVerificationFailureInfo", &c.CustomDomainVerificationFailureInfo) + delete(rawMsg, key) + case "customDomainVerificationTest": + err = unpopulate(val, "CustomDomainVerificationTest", &c.CustomDomainVerificationTest) + delete(rawMsg, key) + case "hasConflictOnManagedEnvironment": + err = unpopulate(val, "HasConflictOnManagedEnvironment", &c.HasConflictOnManagedEnvironment) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &c.HostName) + delete(rawMsg, key) + case "isHostnameAlreadyVerified": + err = unpopulate(val, "IsHostnameAlreadyVerified", &c.IsHostnameAlreadyVerified) + delete(rawMsg, key) + case "txtRecords": + err = unpopulate(val, "TxtRecords", &c.TxtRecords) + 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 CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo. +func (c CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "details", c.Details) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo. +func (c *CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &c.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + 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 CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem. +func (c CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem. +func (c *CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + 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 CustomOpenIDConnectProvider. +func (c CustomOpenIDConnectProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", c.Enabled) + populate(objectMap, "login", c.Login) + populate(objectMap, "registration", c.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomOpenIDConnectProvider. +func (c *CustomOpenIDConnectProvider) 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 "enabled": + err = unpopulate(val, "Enabled", &c.Enabled) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &c.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &c.Registration) + 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 CustomScaleRule. +func (c CustomScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auth", c.Auth) + populate(objectMap, "metadata", c.Metadata) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomScaleRule. +func (c *CustomScaleRule) 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 "auth": + err = unpopulate(val, "Auth", &c.Auth) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &c.Metadata) + 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 Dapr. +func (d Dapr) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appId", d.AppID) + populate(objectMap, "appPort", d.AppPort) + populate(objectMap, "appProtocol", d.AppProtocol) + populate(objectMap, "enableApiLogging", d.EnableAPILogging) + populate(objectMap, "enabled", d.Enabled) + populate(objectMap, "httpMaxRequestSize", d.HTTPMaxRequestSize) + populate(objectMap, "httpReadBufferSize", d.HTTPReadBufferSize) + populate(objectMap, "logLevel", d.LogLevel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dapr. +func (d *Dapr) 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 "appId": + err = unpopulate(val, "AppID", &d.AppID) + delete(rawMsg, key) + case "appPort": + err = unpopulate(val, "AppPort", &d.AppPort) + delete(rawMsg, key) + case "appProtocol": + err = unpopulate(val, "AppProtocol", &d.AppProtocol) + delete(rawMsg, key) + case "enableApiLogging": + err = unpopulate(val, "EnableAPILogging", &d.EnableAPILogging) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + delete(rawMsg, key) + case "httpMaxRequestSize": + err = unpopulate(val, "HTTPMaxRequestSize", &d.HTTPMaxRequestSize) + delete(rawMsg, key) + case "httpReadBufferSize": + err = unpopulate(val, "HTTPReadBufferSize", &d.HTTPReadBufferSize) + delete(rawMsg, key) + case "logLevel": + err = unpopulate(val, "LogLevel", &d.LogLevel) + 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 DaprComponent. +func (d DaprComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponent. +func (d *DaprComponent) 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 "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + 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 DaprComponentProperties. +func (d DaprComponentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "componentType", d.ComponentType) + populate(objectMap, "ignoreErrors", d.IgnoreErrors) + populate(objectMap, "initTimeout", d.InitTimeout) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "scopes", d.Scopes) + populate(objectMap, "secretStoreComponent", d.SecretStoreComponent) + populate(objectMap, "secrets", d.Secrets) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentProperties. +func (d *DaprComponentProperties) 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 "componentType": + err = unpopulate(val, "ComponentType", &d.ComponentType) + delete(rawMsg, key) + case "ignoreErrors": + err = unpopulate(val, "IgnoreErrors", &d.IgnoreErrors) + delete(rawMsg, key) + case "initTimeout": + err = unpopulate(val, "InitTimeout", &d.InitTimeout) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &d.Scopes) + delete(rawMsg, key) + case "secretStoreComponent": + err = unpopulate(val, "SecretStoreComponent", &d.SecretStoreComponent) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &d.Secrets) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + 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 DaprComponentsCollection. +func (d DaprComponentsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentsCollection. +func (d *DaprComponentsCollection) 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 DaprMetadata. +func (d DaprMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + populate(objectMap, "secretRef", d.SecretRef) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprMetadata. +func (d *DaprMetadata) 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 "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "secretRef": + err = unpopulate(val, "SecretRef", &d.SecretRef) + 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 DaprSecretsCollection. +func (d DaprSecretsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSecretsCollection. +func (d *DaprSecretsCollection) 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 "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 DefaultAuthorizationPolicy. +func (d DefaultAuthorizationPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedApplications", d.AllowedApplications) + populate(objectMap, "allowedPrincipals", d.AllowedPrincipals) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultAuthorizationPolicy. +func (d *DefaultAuthorizationPolicy) 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 "allowedApplications": + err = unpopulate(val, "AllowedApplications", &d.AllowedApplications) + delete(rawMsg, key) + case "allowedPrincipals": + err = unpopulate(val, "AllowedPrincipals", &d.AllowedPrincipals) + 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 DefaultErrorResponse. +func (d DefaultErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", d.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponse. +func (d *DefaultErrorResponse) 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 "error": + err = unpopulate(val, "Error", &d.Error) + 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 DefaultErrorResponseError. +func (d DefaultErrorResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", d.Code) + populate(objectMap, "details", d.Details) + populate(objectMap, "innererror", d.Innererror) + populate(objectMap, "message", d.Message) + populate(objectMap, "target", d.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponseError. +func (d *DefaultErrorResponseError) 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 "code": + err = unpopulate(val, "Code", &d.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &d.Details) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &d.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + 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 DefaultErrorResponseErrorDetailsItem. +func (d DefaultErrorResponseErrorDetailsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", d.Code) + populate(objectMap, "message", d.Message) + populate(objectMap, "target", d.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponseErrorDetailsItem. +func (d *DefaultErrorResponseErrorDetailsItem) 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 "code": + err = unpopulate(val, "Code", &d.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + 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 DiagnosticDataProviderMetadata. +func (d DiagnosticDataProviderMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "propertyBag", d.PropertyBag) + populate(objectMap, "providerName", d.ProviderName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDataProviderMetadata. +func (d *DiagnosticDataProviderMetadata) 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 "propertyBag": + err = unpopulate(val, "PropertyBag", &d.PropertyBag) + delete(rawMsg, key) + case "providerName": + err = unpopulate(val, "ProviderName", &d.ProviderName) + 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 DiagnosticDataProviderMetadataPropertyBagItem. +func (d DiagnosticDataProviderMetadataPropertyBagItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDataProviderMetadataPropertyBagItem. +func (d *DiagnosticDataProviderMetadataPropertyBagItem) 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 "name": + err = unpopulate(val, "Name", &d.Name) + 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 DiagnosticDataTableResponseColumn. +func (d DiagnosticDataTableResponseColumn) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "columnName", d.ColumnName) + populate(objectMap, "columnType", d.ColumnType) + populate(objectMap, "dataType", d.DataType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDataTableResponseColumn. +func (d *DiagnosticDataTableResponseColumn) 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 "columnName": + err = unpopulate(val, "ColumnName", &d.ColumnName) + delete(rawMsg, key) + case "columnType": + err = unpopulate(val, "ColumnType", &d.ColumnType) + delete(rawMsg, key) + case "dataType": + err = unpopulate(val, "DataType", &d.DataType) + 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 DiagnosticDataTableResponseObject. +func (d DiagnosticDataTableResponseObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "columns", d.Columns) + populate(objectMap, "rows", d.Rows) + populate(objectMap, "tableName", d.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDataTableResponseObject. +func (d *DiagnosticDataTableResponseObject) 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 "columns": + err = unpopulate(val, "Columns", &d.Columns) + delete(rawMsg, key) + case "rows": + err = unpopulate(val, "Rows", &d.Rows) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &d.TableName) + 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 DiagnosticRendering. +func (d DiagnosticRendering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", d.Description) + populate(objectMap, "isVisible", d.IsVisible) + populate(objectMap, "title", d.Title) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticRendering. +func (d *DiagnosticRendering) 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 "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "isVisible": + err = unpopulate(val, "IsVisible", &d.IsVisible) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &d.Title) + 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 DiagnosticSupportTopic. +func (d DiagnosticSupportTopic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "pesId", d.PesID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSupportTopic. +func (d *DiagnosticSupportTopic) 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 "pesId": + err = unpopulate(val, "PesID", &d.PesID) + 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 Diagnostics. +func (d Diagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Diagnostics. +func (d *Diagnostics) 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 "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + 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 DiagnosticsCollection. +func (d DiagnosticsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsCollection. +func (d *DiagnosticsCollection) 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 DiagnosticsDataAPIResponse. +func (d DiagnosticsDataAPIResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "renderingProperties", d.RenderingProperties) + populate(objectMap, "table", d.Table) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsDataAPIResponse. +func (d *DiagnosticsDataAPIResponse) 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 "renderingProperties": + err = unpopulate(val, "RenderingProperties", &d.RenderingProperties) + delete(rawMsg, key) + case "table": + err = unpopulate(val, "Table", &d.Table) + 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 DiagnosticsDefinition. +func (d DiagnosticsDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "analysisTypes", d.AnalysisTypes) + populate(objectMap, "author", d.Author) + populate(objectMap, "category", d.Category) + populate(objectMap, "description", d.Description) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "score", d.Score) + populate(objectMap, "supportTopicList", d.SupportTopicList) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsDefinition. +func (d *DiagnosticsDefinition) 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 "analysisTypes": + err = unpopulate(val, "AnalysisTypes", &d.AnalysisTypes) + delete(rawMsg, key) + case "author": + err = unpopulate(val, "Author", &d.Author) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &d.Category) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "score": + err = unpopulate(val, "Score", &d.Score) + delete(rawMsg, key) + case "supportTopicList": + err = unpopulate(val, "SupportTopicList", &d.SupportTopicList) + 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 DiagnosticsProperties. +func (d DiagnosticsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataProviderMetadata", d.DataProviderMetadata) + populate(objectMap, "dataset", d.Dataset) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "status", d.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsProperties. +func (d *DiagnosticsProperties) 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 "dataProviderMetadata": + err = unpopulate(val, "DataProviderMetadata", &d.DataProviderMetadata) + delete(rawMsg, key) + case "dataset": + err = unpopulate(val, "Dataset", &d.Dataset) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + 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 DiagnosticsStatus. +func (d DiagnosticsStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", d.Message) + populate(objectMap, "statusId", d.StatusID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsStatus. +func (d *DiagnosticsStatus) 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 "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "statusId": + err = unpopulate(val, "StatusID", &d.StatusID) + 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 EnvironmentSKUProperties. +func (e EnvironmentSKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentSKUProperties. +func (e *EnvironmentSKUProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnvironmentVar. +func (e EnvironmentVar) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + populate(objectMap, "secretRef", e.SecretRef) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentVar. +func (e *EnvironmentVar) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "secretRef": + err = unpopulate(val, "SecretRef", &e.SecretRef) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Facebook. +func (f Facebook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", f.Enabled) + populate(objectMap, "graphApiVersion", f.GraphAPIVersion) + populate(objectMap, "login", f.Login) + populate(objectMap, "registration", f.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Facebook. +func (f *Facebook) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &f.Enabled) + delete(rawMsg, key) + case "graphApiVersion": + err = unpopulate(val, "GraphAPIVersion", &f.GraphAPIVersion) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &f.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &f.Registration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForwardProxy. +func (f ForwardProxy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "convention", f.Convention) + populate(objectMap, "customHostHeaderName", f.CustomHostHeaderName) + populate(objectMap, "customProtoHeaderName", f.CustomProtoHeaderName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForwardProxy. +func (f *ForwardProxy) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "convention": + err = unpopulate(val, "Convention", &f.Convention) + delete(rawMsg, key) + case "customHostHeaderName": + err = unpopulate(val, "CustomHostHeaderName", &f.CustomHostHeaderName) + delete(rawMsg, key) + case "customProtoHeaderName": + err = unpopulate(val, "CustomProtoHeaderName", &f.CustomProtoHeaderName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GitHub. +func (g GitHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", g.Enabled) + populate(objectMap, "login", g.Login) + populate(objectMap, "registration", g.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GitHub. +func (g *GitHub) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &g.Enabled) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &g.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &g.Registration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GithubActionConfiguration. +func (g GithubActionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureCredentials", g.AzureCredentials) + populate(objectMap, "contextPath", g.ContextPath) + populate(objectMap, "image", g.Image) + populate(objectMap, "os", g.OS) + populate(objectMap, "publishType", g.PublishType) + populate(objectMap, "registryInfo", g.RegistryInfo) + populate(objectMap, "runtimeStack", g.RuntimeStack) + populate(objectMap, "runtimeVersion", g.RuntimeVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GithubActionConfiguration. +func (g *GithubActionConfiguration) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureCredentials": + err = unpopulate(val, "AzureCredentials", &g.AzureCredentials) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &g.ContextPath) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &g.Image) + delete(rawMsg, key) + case "os": + err = unpopulate(val, "OS", &g.OS) + delete(rawMsg, key) + case "publishType": + err = unpopulate(val, "PublishType", &g.PublishType) + delete(rawMsg, key) + case "registryInfo": + err = unpopulate(val, "RegistryInfo", &g.RegistryInfo) + delete(rawMsg, key) + case "runtimeStack": + err = unpopulate(val, "RuntimeStack", &g.RuntimeStack) + delete(rawMsg, key) + case "runtimeVersion": + err = unpopulate(val, "RuntimeVersion", &g.RuntimeVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GlobalValidation. +func (g GlobalValidation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "excludedPaths", g.ExcludedPaths) + populate(objectMap, "redirectToProvider", g.RedirectToProvider) + populate(objectMap, "unauthenticatedClientAction", g.UnauthenticatedClientAction) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalValidation. +func (g *GlobalValidation) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "excludedPaths": + err = unpopulate(val, "ExcludedPaths", &g.ExcludedPaths) + delete(rawMsg, key) + case "redirectToProvider": + err = unpopulate(val, "RedirectToProvider", &g.RedirectToProvider) + delete(rawMsg, key) + case "unauthenticatedClientAction": + err = unpopulate(val, "UnauthenticatedClientAction", &g.UnauthenticatedClientAction) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Google. +func (g Google) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", g.Enabled) + populate(objectMap, "login", g.Login) + populate(objectMap, "registration", g.Registration) + populate(objectMap, "validation", g.Validation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Google. +func (g *Google) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &g.Enabled) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &g.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &g.Registration) + delete(rawMsg, key) + case "validation": + err = unpopulate(val, "Validation", &g.Validation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPScaleRule. +func (h HTTPScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auth", h.Auth) + populate(objectMap, "metadata", h.Metadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPScaleRule. +func (h *HTTPScaleRule) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auth": + err = unpopulate(val, "Auth", &h.Auth) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &h.Metadata) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPSettings. +func (h HTTPSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "forwardProxy", h.ForwardProxy) + populate(objectMap, "requireHttps", h.RequireHTTPS) + populate(objectMap, "routes", h.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPSettings. +func (h *HTTPSettings) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "forwardProxy": + err = unpopulate(val, "ForwardProxy", &h.ForwardProxy) + delete(rawMsg, key) + case "requireHttps": + err = unpopulate(val, "RequireHTTPS", &h.RequireHTTPS) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &h.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPSettingsRoutes. +func (h HTTPSettingsRoutes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiPrefix", h.APIPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPSettingsRoutes. +func (h *HTTPSettingsRoutes) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiPrefix": + err = unpopulate(val, "APIPrefix", &h.APIPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPSecurityRestrictionRule. +func (i IPSecurityRestrictionRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", i.Action) + populate(objectMap, "description", i.Description) + populate(objectMap, "ipAddressRange", i.IPAddressRange) + populate(objectMap, "name", i.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPSecurityRestrictionRule. +func (i *IPSecurityRestrictionRule) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "ipAddressRange": + err = unpopulate(val, "IPAddressRange", &i.IPAddressRange) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IdentityProviders. +func (i IdentityProviders) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apple", i.Apple) + populate(objectMap, "azureActiveDirectory", i.AzureActiveDirectory) + populate(objectMap, "azureStaticWebApps", i.AzureStaticWebApps) + populate(objectMap, "customOpenIdConnectProviders", i.CustomOpenIDConnectProviders) + populate(objectMap, "facebook", i.Facebook) + populate(objectMap, "gitHub", i.GitHub) + populate(objectMap, "google", i.Google) + populate(objectMap, "twitter", i.Twitter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviders. +func (i *IdentityProviders) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apple": + err = unpopulate(val, "Apple", &i.Apple) + delete(rawMsg, key) + case "azureActiveDirectory": + err = unpopulate(val, "AzureActiveDirectory", &i.AzureActiveDirectory) + delete(rawMsg, key) + case "azureStaticWebApps": + err = unpopulate(val, "AzureStaticWebApps", &i.AzureStaticWebApps) + delete(rawMsg, key) + case "customOpenIdConnectProviders": + err = unpopulate(val, "CustomOpenIDConnectProviders", &i.CustomOpenIDConnectProviders) + delete(rawMsg, key) + case "facebook": + err = unpopulate(val, "Facebook", &i.Facebook) + delete(rawMsg, key) + case "gitHub": + err = unpopulate(val, "GitHub", &i.GitHub) + delete(rawMsg, key) + case "google": + err = unpopulate(val, "Google", &i.Google) + delete(rawMsg, key) + case "twitter": + err = unpopulate(val, "Twitter", &i.Twitter) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Ingress. +func (i Ingress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowInsecure", i.AllowInsecure) + populate(objectMap, "customDomains", i.CustomDomains) + populate(objectMap, "exposedPort", i.ExposedPort) + populate(objectMap, "external", i.External) + populate(objectMap, "fqdn", i.Fqdn) + populate(objectMap, "ipSecurityRestrictions", i.IPSecurityRestrictions) + populate(objectMap, "targetPort", i.TargetPort) + populate(objectMap, "traffic", i.Traffic) + populate(objectMap, "transport", i.Transport) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Ingress. +func (i *Ingress) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowInsecure": + err = unpopulate(val, "AllowInsecure", &i.AllowInsecure) + delete(rawMsg, key) + case "customDomains": + err = unpopulate(val, "CustomDomains", &i.CustomDomains) + delete(rawMsg, key) + case "exposedPort": + err = unpopulate(val, "ExposedPort", &i.ExposedPort) + delete(rawMsg, key) + case "external": + err = unpopulate(val, "External", &i.External) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &i.Fqdn) + delete(rawMsg, key) + case "ipSecurityRestrictions": + err = unpopulate(val, "IPSecurityRestrictions", &i.IPSecurityRestrictions) + delete(rawMsg, key) + case "targetPort": + err = unpopulate(val, "TargetPort", &i.TargetPort) + delete(rawMsg, key) + case "traffic": + err = unpopulate(val, "Traffic", &i.Traffic) + delete(rawMsg, key) + case "transport": + err = unpopulate(val, "Transport", &i.Transport) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InitContainer. +func (i InitContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "args", i.Args) + populate(objectMap, "command", i.Command) + populate(objectMap, "env", i.Env) + populate(objectMap, "image", i.Image) + populate(objectMap, "name", i.Name) + populate(objectMap, "resources", i.Resources) + populate(objectMap, "volumeMounts", i.VolumeMounts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InitContainer. +func (i *InitContainer) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "args": + err = unpopulate(val, "Args", &i.Args) + delete(rawMsg, key) + case "command": + err = unpopulate(val, "Command", &i.Command) + delete(rawMsg, key) + case "env": + err = unpopulate(val, "Env", &i.Env) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &i.Image) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &i.Resources) + delete(rawMsg, key) + case "volumeMounts": + err = unpopulate(val, "VolumeMounts", &i.VolumeMounts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JwtClaimChecks. +func (j JwtClaimChecks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedClientApplications", j.AllowedClientApplications) + populate(objectMap, "allowedGroups", j.AllowedGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JwtClaimChecks. +func (j *JwtClaimChecks) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedClientApplications": + err = unpopulate(val, "AllowedClientApplications", &j.AllowedClientApplications) + delete(rawMsg, key) + case "allowedGroups": + err = unpopulate(val, "AllowedGroups", &j.AllowedGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsConfiguration. +func (l LogAnalyticsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customerId", l.CustomerID) + populate(objectMap, "sharedKey", l.SharedKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsConfiguration. +func (l *LogAnalyticsConfiguration) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerId": + err = unpopulate(val, "CustomerID", &l.CustomerID) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &l.SharedKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Login. +func (l Login) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedExternalRedirectUrls", l.AllowedExternalRedirectUrls) + populate(objectMap, "cookieExpiration", l.CookieExpiration) + populate(objectMap, "nonce", l.Nonce) + populate(objectMap, "preserveUrlFragmentsForLogins", l.PreserveURLFragmentsForLogins) + populate(objectMap, "routes", l.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Login. +func (l *Login) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedExternalRedirectUrls": + err = unpopulate(val, "AllowedExternalRedirectUrls", &l.AllowedExternalRedirectUrls) + delete(rawMsg, key) + case "cookieExpiration": + err = unpopulate(val, "CookieExpiration", &l.CookieExpiration) + delete(rawMsg, key) + case "nonce": + err = unpopulate(val, "Nonce", &l.Nonce) + delete(rawMsg, key) + case "preserveUrlFragmentsForLogins": + err = unpopulate(val, "PreserveURLFragmentsForLogins", &l.PreserveURLFragmentsForLogins) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &l.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoginRoutes. +func (l LoginRoutes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logoutEndpoint", l.LogoutEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoginRoutes. +func (l *LoginRoutes) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logoutEndpoint": + err = unpopulate(val, "LogoutEndpoint", &l.LogoutEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoginScopes. +func (l LoginScopes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "scopes", l.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoginScopes. +func (l *LoginScopes) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scopes": + err = unpopulate(val, "Scopes", &l.Scopes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogsConfiguration. +func (l LogsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destination", l.Destination) + populate(objectMap, "logAnalyticsConfiguration", l.LogAnalyticsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogsConfiguration. +func (l *LogsConfiguration) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destination": + err = unpopulate(val, "Destination", &l.Destination) + delete(rawMsg, key) + case "logAnalyticsConfiguration": + err = unpopulate(val, "LogAnalyticsConfiguration", &l.LogAnalyticsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedEnvironment. +func (m ManagedEnvironment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "sku", m.SKU) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedEnvironment. +func (m *ManagedEnvironment) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &m.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedEnvironmentProperties. +func (m ManagedEnvironmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appLogsConfiguration", m.AppLogsConfiguration) + populate(objectMap, "customDomainConfiguration", m.CustomDomainConfiguration) + populate(objectMap, "daprAIConnectionString", m.DaprAIConnectionString) + populate(objectMap, "daprAIInstrumentationKey", m.DaprAIInstrumentationKey) + populate(objectMap, "defaultDomain", m.DefaultDomain) + populate(objectMap, "deploymentErrors", m.DeploymentErrors) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "staticIp", m.StaticIP) + populate(objectMap, "vnetConfiguration", m.VnetConfiguration) + populate(objectMap, "workloadProfiles", m.WorkloadProfiles) + populate(objectMap, "zoneRedundant", m.ZoneRedundant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedEnvironmentProperties. +func (m *ManagedEnvironmentProperties) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appLogsConfiguration": + err = unpopulate(val, "AppLogsConfiguration", &m.AppLogsConfiguration) + delete(rawMsg, key) + case "customDomainConfiguration": + err = unpopulate(val, "CustomDomainConfiguration", &m.CustomDomainConfiguration) + delete(rawMsg, key) + case "daprAIConnectionString": + err = unpopulate(val, "DaprAIConnectionString", &m.DaprAIConnectionString) + delete(rawMsg, key) + case "daprAIInstrumentationKey": + err = unpopulate(val, "DaprAIInstrumentationKey", &m.DaprAIInstrumentationKey) + delete(rawMsg, key) + case "defaultDomain": + err = unpopulate(val, "DefaultDomain", &m.DefaultDomain) + delete(rawMsg, key) + case "deploymentErrors": + err = unpopulate(val, "DeploymentErrors", &m.DeploymentErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "staticIp": + err = unpopulate(val, "StaticIP", &m.StaticIP) + delete(rawMsg, key) + case "vnetConfiguration": + err = unpopulate(val, "VnetConfiguration", &m.VnetConfiguration) + delete(rawMsg, key) + case "workloadProfiles": + err = unpopulate(val, "WorkloadProfiles", &m.WorkloadProfiles) + delete(rawMsg, key) + case "zoneRedundant": + err = unpopulate(val, "ZoneRedundant", &m.ZoneRedundant) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedEnvironmentStorage. +func (m ManagedEnvironmentStorage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedEnvironmentStorage. +func (m *ManagedEnvironmentStorage) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedEnvironmentStorageProperties. +func (m ManagedEnvironmentStorageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureFile", m.AzureFile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedEnvironmentStorageProperties. +func (m *ManagedEnvironmentStorageProperties) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureFile": + err = unpopulate(val, "AzureFile", &m.AzureFile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedEnvironmentStoragesCollection. +func (m ManagedEnvironmentStoragesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedEnvironmentStoragesCollection. +func (m *ManagedEnvironmentStoragesCollection) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedEnvironmentsCollection. +func (m ManagedEnvironmentsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedEnvironmentsCollection. +func (m *ManagedEnvironmentsCollection) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Nonce. +func (n Nonce) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nonceExpirationInterval", n.NonceExpirationInterval) + populate(objectMap, "validateNonce", n.ValidateNonce) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Nonce. +func (n *Nonce) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nonceExpirationInterval": + err = unpopulate(val, "NonceExpirationInterval", &n.NonceExpirationInterval) + delete(rawMsg, key) + case "validateNonce": + err = unpopulate(val, "ValidateNonce", &n.ValidateNonce) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OpenIDConnectClientCredential. +func (o OpenIDConnectClientCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientSecretSettingName", o.ClientSecretSettingName) + objectMap["method"] = "ClientSecretPost" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenIDConnectClientCredential. +func (o *OpenIDConnectClientCredential) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientSecretSettingName": + err = unpopulate(val, "ClientSecretSettingName", &o.ClientSecretSettingName) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &o.Method) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OpenIDConnectConfig. +func (o OpenIDConnectConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizationEndpoint", o.AuthorizationEndpoint) + populate(objectMap, "certificationUri", o.CertificationURI) + populate(objectMap, "issuer", o.Issuer) + populate(objectMap, "tokenEndpoint", o.TokenEndpoint) + populate(objectMap, "wellKnownOpenIdConfiguration", o.WellKnownOpenIDConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenIDConnectConfig. +func (o *OpenIDConnectConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationEndpoint": + err = unpopulate(val, "AuthorizationEndpoint", &o.AuthorizationEndpoint) + delete(rawMsg, key) + case "certificationUri": + err = unpopulate(val, "CertificationURI", &o.CertificationURI) + delete(rawMsg, key) + case "issuer": + err = unpopulate(val, "Issuer", &o.Issuer) + delete(rawMsg, key) + case "tokenEndpoint": + err = unpopulate(val, "TokenEndpoint", &o.TokenEndpoint) + delete(rawMsg, key) + case "wellKnownOpenIdConfiguration": + err = unpopulate(val, "WellKnownOpenIDConfiguration", &o.WellKnownOpenIDConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OpenIDConnectLogin. +func (o OpenIDConnectLogin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nameClaimType", o.NameClaimType) + populate(objectMap, "scopes", o.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenIDConnectLogin. +func (o *OpenIDConnectLogin) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nameClaimType": + err = unpopulate(val, "NameClaimType", &o.NameClaimType) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &o.Scopes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OpenIDConnectRegistration. +func (o OpenIDConnectRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientCredential", o.ClientCredential) + populate(objectMap, "clientId", o.ClientID) + populate(objectMap, "openIdConnectConfiguration", o.OpenIDConnectConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenIDConnectRegistration. +func (o *OpenIDConnectRegistration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientCredential": + err = unpopulate(val, "ClientCredential", &o.ClientCredential) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &o.ClientID) + delete(rawMsg, key) + case "openIdConnectConfiguration": + err = unpopulate(val, "OpenIDConnectConfiguration", &o.OpenIDConnectConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDetail. +func (o OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDetail. +func (o *OperationDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueueScaleRule. +func (q QueueScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auth", q.Auth) + populate(objectMap, "queueLength", q.QueueLength) + populate(objectMap, "queueName", q.QueueName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueueScaleRule. +func (q *QueueScaleRule) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auth": + err = unpopulate(val, "Auth", &q.Auth) + delete(rawMsg, key) + case "queueLength": + err = unpopulate(val, "QueueLength", &q.QueueLength) + delete(rawMsg, key) + case "queueName": + err = unpopulate(val, "QueueName", &q.QueueName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Registration. +func (r Registration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appId", r.AppID) + populate(objectMap, "appSecretSettingName", r.AppSecretSettingName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Registration. +func (r *Registration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appId": + err = unpopulate(val, "AppID", &r.AppID) + delete(rawMsg, key) + case "appSecretSettingName": + err = unpopulate(val, "AppSecretSettingName", &r.AppSecretSettingName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryCredentials. +func (r RegistryCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "passwordSecretRef", r.PasswordSecretRef) + populate(objectMap, "server", r.Server) + populate(objectMap, "username", r.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryCredentials. +func (r *RegistryCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "passwordSecretRef": + err = unpopulate(val, "PasswordSecretRef", &r.PasswordSecretRef) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &r.Server) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &r.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryInfo. +func (r RegistryInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "registryPassword", r.RegistryPassword) + populate(objectMap, "registryUrl", r.RegistryURL) + populate(objectMap, "registryUserName", r.RegistryUserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryInfo. +func (r *RegistryInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "registryPassword": + err = unpopulate(val, "RegistryPassword", &r.RegistryPassword) + delete(rawMsg, key) + case "registryUrl": + err = unpopulate(val, "RegistryURL", &r.RegistryURL) + delete(rawMsg, key) + case "registryUserName": + err = unpopulate(val, "RegistryUserName", &r.RegistryUserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Replica. +func (r Replica) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Replica. +func (r *Replica) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReplicaCollection. +func (r ReplicaCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaCollection. +func (r *ReplicaCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReplicaContainer. +func (r ReplicaContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containerId", r.ContainerID) + populate(objectMap, "name", r.Name) + populate(objectMap, "ready", r.Ready) + populate(objectMap, "restartCount", r.RestartCount) + populate(objectMap, "started", r.Started) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaContainer. +func (r *ReplicaContainer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "containerId": + err = unpopulate(val, "ContainerID", &r.ContainerID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "ready": + err = unpopulate(val, "Ready", &r.Ready) + delete(rawMsg, key) + case "restartCount": + err = unpopulate(val, "RestartCount", &r.RestartCount) + delete(rawMsg, key) + case "started": + err = unpopulate(val, "Started", &r.Started) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReplicaProperties. +func (r ReplicaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containers", r.Containers) + populateTimeRFC3339(objectMap, "createdTime", r.CreatedTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaProperties. +func (r *ReplicaProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "containers": + err = unpopulate(val, "Containers", &r.Containers) + delete(rawMsg, key) + case "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &r.CreatedTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Revision. +func (r Revision) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Revision. +func (r *Revision) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RevisionCollection. +func (r RevisionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RevisionCollection. +func (r *RevisionCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RevisionProperties. +func (r RevisionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "active", r.Active) + populateTimeRFC3339(objectMap, "createdTime", r.CreatedTime) + populate(objectMap, "fqdn", r.Fqdn) + populate(objectMap, "healthState", r.HealthState) + populate(objectMap, "provisioningError", r.ProvisioningError) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "replicas", r.Replicas) + populate(objectMap, "template", r.Template) + populate(objectMap, "trafficWeight", r.TrafficWeight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RevisionProperties. +func (r *RevisionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "active": + err = unpopulate(val, "Active", &r.Active) + delete(rawMsg, key) + case "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &r.CreatedTime) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &r.Fqdn) + delete(rawMsg, key) + case "healthState": + err = unpopulate(val, "HealthState", &r.HealthState) + delete(rawMsg, key) + case "provisioningError": + err = unpopulate(val, "ProvisioningError", &r.ProvisioningError) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "replicas": + err = unpopulate(val, "Replicas", &r.Replicas) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &r.Template) + delete(rawMsg, key) + case "trafficWeight": + err = unpopulate(val, "TrafficWeight", &r.TrafficWeight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Scale. +func (s Scale) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "maxReplicas", s.MaxReplicas) + populate(objectMap, "minReplicas", s.MinReplicas) + populate(objectMap, "rules", s.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Scale. +func (s *Scale) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxReplicas": + err = unpopulate(val, "MaxReplicas", &s.MaxReplicas) + delete(rawMsg, key) + case "minReplicas": + err = unpopulate(val, "MinReplicas", &s.MinReplicas) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &s.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScaleRule. +func (s ScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureQueue", s.AzureQueue) + populate(objectMap, "custom", s.Custom) + populate(objectMap, "http", s.HTTP) + populate(objectMap, "name", s.Name) + populate(objectMap, "tcp", s.TCP) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleRule. +func (s *ScaleRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureQueue": + err = unpopulate(val, "AzureQueue", &s.AzureQueue) + delete(rawMsg, key) + case "custom": + err = unpopulate(val, "Custom", &s.Custom) + delete(rawMsg, key) + case "http": + err = unpopulate(val, "HTTP", &s.HTTP) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "tcp": + err = unpopulate(val, "TCP", &s.TCP) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScaleRuleAuth. +func (s ScaleRuleAuth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secretRef", s.SecretRef) + populate(objectMap, "triggerParameter", s.TriggerParameter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleRuleAuth. +func (s *ScaleRuleAuth) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secretRef": + err = unpopulate(val, "SecretRef", &s.SecretRef) + delete(rawMsg, key) + case "triggerParameter": + err = unpopulate(val, "TriggerParameter", &s.TriggerParameter) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Secret. +func (s Secret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Secret. +func (s *Secret) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretsCollection. +func (s SecretsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretsCollection. +func (s *SecretsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceControl. +func (s SourceControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControl. +func (s *SourceControl) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceControlCollection. +func (s SourceControlCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControlCollection. +func (s *SourceControlCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceControlProperties. +func (s SourceControlProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "branch", s.Branch) + populate(objectMap, "githubActionConfiguration", s.GithubActionConfiguration) + populate(objectMap, "operationState", s.OperationState) + populate(objectMap, "repoUrl", s.RepoURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControlProperties. +func (s *SourceControlProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "branch": + err = unpopulate(val, "Branch", &s.Branch) + delete(rawMsg, key) + case "githubActionConfiguration": + err = unpopulate(val, "GithubActionConfiguration", &s.GithubActionConfiguration) + delete(rawMsg, key) + case "operationState": + err = unpopulate(val, "OperationState", &s.OperationState) + delete(rawMsg, key) + case "repoUrl": + err = unpopulate(val, "RepoURL", &s.RepoURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TCPScaleRule. +func (t TCPScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auth", t.Auth) + populate(objectMap, "metadata", t.Metadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TCPScaleRule. +func (t *TCPScaleRule) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auth": + err = unpopulate(val, "Auth", &t.Auth) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &t.Metadata) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Template. +func (t Template) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containers", t.Containers) + populate(objectMap, "initContainers", t.InitContainers) + populate(objectMap, "revisionSuffix", t.RevisionSuffix) + populate(objectMap, "scale", t.Scale) + populate(objectMap, "volumes", t.Volumes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Template. +func (t *Template) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "containers": + err = unpopulate(val, "Containers", &t.Containers) + delete(rawMsg, key) + case "initContainers": + err = unpopulate(val, "InitContainers", &t.InitContainers) + delete(rawMsg, key) + case "revisionSuffix": + err = unpopulate(val, "RevisionSuffix", &t.RevisionSuffix) + delete(rawMsg, key) + case "scale": + err = unpopulate(val, "Scale", &t.Scale) + delete(rawMsg, key) + case "volumes": + err = unpopulate(val, "Volumes", &t.Volumes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficWeight. +func (t TrafficWeight) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "label", t.Label) + populate(objectMap, "latestRevision", t.LatestRevision) + populate(objectMap, "revisionName", t.RevisionName) + populate(objectMap, "weight", t.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficWeight. +func (t *TrafficWeight) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "label": + err = unpopulate(val, "Label", &t.Label) + delete(rawMsg, key) + case "latestRevision": + err = unpopulate(val, "LatestRevision", &t.LatestRevision) + delete(rawMsg, key) + case "revisionName": + err = unpopulate(val, "RevisionName", &t.RevisionName) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &t.Weight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Twitter. +func (t Twitter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", t.Enabled) + populate(objectMap, "registration", t.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Twitter. +func (t *Twitter) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &t.Enabled) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &t.Registration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TwitterRegistration. +func (t TwitterRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "consumerKey", t.ConsumerKey) + populate(objectMap, "consumerSecretSettingName", t.ConsumerSecretSettingName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TwitterRegistration. +func (t *TwitterRegistration) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consumerKey": + err = unpopulate(val, "ConsumerKey", &t.ConsumerKey) + delete(rawMsg, key) + case "consumerSecretSettingName": + err = unpopulate(val, "ConsumerSecretSettingName", &t.ConsumerSecretSettingName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VnetConfiguration. +func (v VnetConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dockerBridgeCidr", v.DockerBridgeCidr) + populate(objectMap, "infrastructureSubnetId", v.InfrastructureSubnetID) + populate(objectMap, "internal", v.Internal) + populate(objectMap, "platformReservedCidr", v.PlatformReservedCidr) + populate(objectMap, "platformReservedDnsIP", v.PlatformReservedDNSIP) + populate(objectMap, "runtimeSubnetId", v.RuntimeSubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VnetConfiguration. +func (v *VnetConfiguration) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dockerBridgeCidr": + err = unpopulate(val, "DockerBridgeCidr", &v.DockerBridgeCidr) + delete(rawMsg, key) + case "infrastructureSubnetId": + err = unpopulate(val, "InfrastructureSubnetID", &v.InfrastructureSubnetID) + delete(rawMsg, key) + case "internal": + err = unpopulate(val, "Internal", &v.Internal) + delete(rawMsg, key) + case "platformReservedCidr": + err = unpopulate(val, "PlatformReservedCidr", &v.PlatformReservedCidr) + delete(rawMsg, key) + case "platformReservedDnsIP": + err = unpopulate(val, "PlatformReservedDNSIP", &v.PlatformReservedDNSIP) + delete(rawMsg, key) + case "runtimeSubnetId": + err = unpopulate(val, "RuntimeSubnetID", &v.RuntimeSubnetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Volume. +func (v Volume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "storageName", v.StorageName) + populate(objectMap, "storageType", v.StorageType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Volume. +func (v *Volume) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "storageName": + err = unpopulate(val, "StorageName", &v.StorageName) + delete(rawMsg, key) + case "storageType": + err = unpopulate(val, "StorageType", &v.StorageType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VolumeMount. +func (v VolumeMount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "mountPath", v.MountPath) + populate(objectMap, "volumeName", v.VolumeName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeMount. +func (v *VolumeMount) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mountPath": + err = unpopulate(val, "MountPath", &v.MountPath) + delete(rawMsg, key) + case "volumeName": + err = unpopulate(val, "VolumeName", &v.VolumeName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadProfile. +func (w WorkloadProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "maximumCount", w.MaximumCount) + populate(objectMap, "minimumCount", w.MinimumCount) + populate(objectMap, "workloadProfileType", w.WorkloadProfileType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadProfile. +func (w *WorkloadProfile) 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 "maximumCount": + err = unpopulate(val, "MaximumCount", &w.MaximumCount) + delete(rawMsg, key) + case "minimumCount": + err = unpopulate(val, "MinimumCount", &w.MinimumCount) + delete(rawMsg, key) + case "workloadProfileType": + err = unpopulate(val, "WorkloadProfileType", &w.WorkloadProfileType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray(m map[string]interface{}, k string, b []byte, f runtime.Base64Encoding) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = runtime.EncodeByteArray(b, f) + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/app/armapp/namespaces_client.go b/sdk/resourcemanager/app/armapp/namespaces_client.go new file mode 100644 index 000000000000..2515e50261bd --- /dev/null +++ b/sdk/resourcemanager/app/armapp/namespaces_client.go @@ -0,0 +1,114 @@ +//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 armapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// NamespacesClient contains the methods for the Namespaces group. +// Don't use this type directly, use NewNamespacesClient() instead. +type NamespacesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewNamespacesClient creates a new instance of NamespacesClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NamespacesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &NamespacesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CheckNameAvailability - Checks if resource name is available. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// checkNameAvailabilityRequest - The check name availability request. +// options - NamespacesClientCheckNameAvailabilityOptions contains the optional parameters for the NamespacesClient.CheckNameAvailability +// method. +func (client *NamespacesClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, environmentName string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *NamespacesClientCheckNameAvailabilityOptions) (NamespacesClientCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, environmentName, checkNameAvailabilityRequest, options) + if err != nil { + return NamespacesClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NamespacesClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *NamespacesClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability" + 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 environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *NamespacesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (NamespacesClientCheckNameAvailabilityResponse, error) { + result := NamespacesClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return NamespacesClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/operations_client.go b/sdk/resourcemanager/app/armapp/operations_client.go new file mode 100644 index 000000000000..c1f310b5bb82 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/operations_client.go @@ -0,0 +1,105 @@ +//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 armapp + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + host string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Lists all of the available RP operations. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01-preview +// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.App/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-06-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 *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableOperations); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/response_types.go b/sdk/resourcemanager/app/armapp/response_types.go new file mode 100644 index 000000000000..f21a7b12397a --- /dev/null +++ b/sdk/resourcemanager/app/armapp/response_types.go @@ -0,0 +1,380 @@ +//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 armapp + +// CertificatesClientCreateOrUpdateResponse contains the response from method CertificatesClient.CreateOrUpdate. +type CertificatesClientCreateOrUpdateResponse struct { + Certificate +} + +// CertificatesClientDeleteResponse contains the response from method CertificatesClient.Delete. +type CertificatesClientDeleteResponse struct { + // placeholder for future response values +} + +// CertificatesClientGetResponse contains the response from method CertificatesClient.Get. +type CertificatesClientGetResponse struct { + Certificate +} + +// CertificatesClientListResponse contains the response from method CertificatesClient.List. +type CertificatesClientListResponse struct { + CertificateCollection +} + +// CertificatesClientUpdateResponse contains the response from method CertificatesClient.Update. +type CertificatesClientUpdateResponse struct { + Certificate +} + +// ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsCertificatesClient.CreateOrUpdate. +type ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse struct { + Certificate +} + +// ConnectedEnvironmentsCertificatesClientDeleteResponse contains the response from method ConnectedEnvironmentsCertificatesClient.Delete. +type ConnectedEnvironmentsCertificatesClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectedEnvironmentsCertificatesClientGetResponse contains the response from method ConnectedEnvironmentsCertificatesClient.Get. +type ConnectedEnvironmentsCertificatesClientGetResponse struct { + Certificate +} + +// ConnectedEnvironmentsCertificatesClientListResponse contains the response from method ConnectedEnvironmentsCertificatesClient.List. +type ConnectedEnvironmentsCertificatesClientListResponse struct { + CertificateCollection +} + +// ConnectedEnvironmentsCertificatesClientUpdateResponse contains the response from method ConnectedEnvironmentsCertificatesClient.Update. +type ConnectedEnvironmentsCertificatesClientUpdateResponse struct { + Certificate +} + +// ConnectedEnvironmentsClientCheckNameAvailabilityResponse contains the response from method ConnectedEnvironmentsClient.CheckNameAvailability. +type ConnectedEnvironmentsClientCheckNameAvailabilityResponse struct { + CheckNameAvailabilityResponse +} + +// ConnectedEnvironmentsClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsClient.CreateOrUpdate. +type ConnectedEnvironmentsClientCreateOrUpdateResponse struct { + ConnectedEnvironment +} + +// ConnectedEnvironmentsClientDeleteResponse contains the response from method ConnectedEnvironmentsClient.Delete. +type ConnectedEnvironmentsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectedEnvironmentsClientGetResponse contains the response from method ConnectedEnvironmentsClient.Get. +type ConnectedEnvironmentsClientGetResponse struct { + ConnectedEnvironment +} + +// ConnectedEnvironmentsClientListByResourceGroupResponse contains the response from method ConnectedEnvironmentsClient.ListByResourceGroup. +type ConnectedEnvironmentsClientListByResourceGroupResponse struct { + ConnectedEnvironmentCollection +} + +// ConnectedEnvironmentsClientListBySubscriptionResponse contains the response from method ConnectedEnvironmentsClient.ListBySubscription. +type ConnectedEnvironmentsClientListBySubscriptionResponse struct { + ConnectedEnvironmentCollection +} + +// ConnectedEnvironmentsClientUpdateResponse contains the response from method ConnectedEnvironmentsClient.Update. +type ConnectedEnvironmentsClientUpdateResponse struct { + ConnectedEnvironment +} + +// ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate. +type ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse struct { + DaprComponent +} + +// ConnectedEnvironmentsDaprComponentsClientDeleteResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.Delete. +type ConnectedEnvironmentsDaprComponentsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectedEnvironmentsDaprComponentsClientGetResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.Get. +type ConnectedEnvironmentsDaprComponentsClientGetResponse struct { + DaprComponent +} + +// ConnectedEnvironmentsDaprComponentsClientListResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.List. +type ConnectedEnvironmentsDaprComponentsClientListResponse struct { + DaprComponentsCollection +} + +// ConnectedEnvironmentsDaprComponentsClientListSecretsResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.ListSecrets. +type ConnectedEnvironmentsDaprComponentsClientListSecretsResponse struct { + DaprSecretsCollection +} + +// ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsStoragesClient.CreateOrUpdate. +type ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse struct { + ConnectedEnvironmentStorage +} + +// ConnectedEnvironmentsStoragesClientDeleteResponse contains the response from method ConnectedEnvironmentsStoragesClient.Delete. +type ConnectedEnvironmentsStoragesClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectedEnvironmentsStoragesClientGetResponse contains the response from method ConnectedEnvironmentsStoragesClient.Get. +type ConnectedEnvironmentsStoragesClientGetResponse struct { + ConnectedEnvironmentStorage +} + +// ConnectedEnvironmentsStoragesClientListResponse contains the response from method ConnectedEnvironmentsStoragesClient.List. +type ConnectedEnvironmentsStoragesClientListResponse struct { + ConnectedEnvironmentStoragesCollection +} + +// ContainerAppsAuthConfigsClientCreateOrUpdateResponse contains the response from method ContainerAppsAuthConfigsClient.CreateOrUpdate. +type ContainerAppsAuthConfigsClientCreateOrUpdateResponse struct { + AuthConfig +} + +// ContainerAppsAuthConfigsClientDeleteResponse contains the response from method ContainerAppsAuthConfigsClient.Delete. +type ContainerAppsAuthConfigsClientDeleteResponse struct { + // placeholder for future response values +} + +// ContainerAppsAuthConfigsClientGetResponse contains the response from method ContainerAppsAuthConfigsClient.Get. +type ContainerAppsAuthConfigsClientGetResponse struct { + AuthConfig +} + +// ContainerAppsAuthConfigsClientListByContainerAppResponse contains the response from method ContainerAppsAuthConfigsClient.ListByContainerApp. +type ContainerAppsAuthConfigsClientListByContainerAppResponse struct { + AuthConfigCollection +} + +// ContainerAppsClientCreateOrUpdateResponse contains the response from method ContainerAppsClient.CreateOrUpdate. +type ContainerAppsClientCreateOrUpdateResponse struct { + ContainerApp +} + +// ContainerAppsClientDeleteResponse contains the response from method ContainerAppsClient.Delete. +type ContainerAppsClientDeleteResponse struct { + // placeholder for future response values +} + +// ContainerAppsClientGetResponse contains the response from method ContainerAppsClient.Get. +type ContainerAppsClientGetResponse struct { + ContainerApp +} + +// ContainerAppsClientListByResourceGroupResponse contains the response from method ContainerAppsClient.ListByResourceGroup. +type ContainerAppsClientListByResourceGroupResponse struct { + ContainerAppCollection +} + +// ContainerAppsClientListBySubscriptionResponse contains the response from method ContainerAppsClient.ListBySubscription. +type ContainerAppsClientListBySubscriptionResponse struct { + ContainerAppCollection +} + +// ContainerAppsClientListCustomHostNameAnalysisResponse contains the response from method ContainerAppsClient.ListCustomHostNameAnalysis. +type ContainerAppsClientListCustomHostNameAnalysisResponse struct { + CustomHostnameAnalysisResult +} + +// ContainerAppsClientListSecretsResponse contains the response from method ContainerAppsClient.ListSecrets. +type ContainerAppsClientListSecretsResponse struct { + SecretsCollection +} + +// ContainerAppsClientUpdateResponse contains the response from method ContainerAppsClient.Update. +type ContainerAppsClientUpdateResponse struct { + // placeholder for future response values +} + +// ContainerAppsDiagnosticsClientGetDetectorResponse contains the response from method ContainerAppsDiagnosticsClient.GetDetector. +type ContainerAppsDiagnosticsClientGetDetectorResponse struct { + Diagnostics +} + +// ContainerAppsDiagnosticsClientGetRevisionResponse contains the response from method ContainerAppsDiagnosticsClient.GetRevision. +type ContainerAppsDiagnosticsClientGetRevisionResponse struct { + Revision +} + +// ContainerAppsDiagnosticsClientGetRootResponse contains the response from method ContainerAppsDiagnosticsClient.GetRoot. +type ContainerAppsDiagnosticsClientGetRootResponse struct { + ContainerApp +} + +// ContainerAppsDiagnosticsClientListDetectorsResponse contains the response from method ContainerAppsDiagnosticsClient.ListDetectors. +type ContainerAppsDiagnosticsClientListDetectorsResponse struct { + DiagnosticsCollection +} + +// ContainerAppsDiagnosticsClientListRevisionsResponse contains the response from method ContainerAppsDiagnosticsClient.ListRevisions. +type ContainerAppsDiagnosticsClientListRevisionsResponse struct { + RevisionCollection +} + +// ContainerAppsRevisionReplicasClientGetReplicaResponse contains the response from method ContainerAppsRevisionReplicasClient.GetReplica. +type ContainerAppsRevisionReplicasClientGetReplicaResponse struct { + Replica +} + +// ContainerAppsRevisionReplicasClientListReplicasResponse contains the response from method ContainerAppsRevisionReplicasClient.ListReplicas. +type ContainerAppsRevisionReplicasClientListReplicasResponse struct { + ReplicaCollection +} + +// ContainerAppsRevisionsClientActivateRevisionResponse contains the response from method ContainerAppsRevisionsClient.ActivateRevision. +type ContainerAppsRevisionsClientActivateRevisionResponse struct { + // placeholder for future response values +} + +// ContainerAppsRevisionsClientDeactivateRevisionResponse contains the response from method ContainerAppsRevisionsClient.DeactivateRevision. +type ContainerAppsRevisionsClientDeactivateRevisionResponse struct { + // placeholder for future response values +} + +// ContainerAppsRevisionsClientGetRevisionResponse contains the response from method ContainerAppsRevisionsClient.GetRevision. +type ContainerAppsRevisionsClientGetRevisionResponse struct { + Revision +} + +// ContainerAppsRevisionsClientListRevisionsResponse contains the response from method ContainerAppsRevisionsClient.ListRevisions. +type ContainerAppsRevisionsClientListRevisionsResponse struct { + RevisionCollection +} + +// ContainerAppsRevisionsClientRestartRevisionResponse contains the response from method ContainerAppsRevisionsClient.RestartRevision. +type ContainerAppsRevisionsClientRestartRevisionResponse struct { + // placeholder for future response values +} + +// ContainerAppsSourceControlsClientCreateOrUpdateResponse contains the response from method ContainerAppsSourceControlsClient.CreateOrUpdate. +type ContainerAppsSourceControlsClientCreateOrUpdateResponse struct { + SourceControl +} + +// ContainerAppsSourceControlsClientDeleteResponse contains the response from method ContainerAppsSourceControlsClient.Delete. +type ContainerAppsSourceControlsClientDeleteResponse struct { + // placeholder for future response values +} + +// ContainerAppsSourceControlsClientGetResponse contains the response from method ContainerAppsSourceControlsClient.Get. +type ContainerAppsSourceControlsClientGetResponse struct { + SourceControl +} + +// ContainerAppsSourceControlsClientListByContainerAppResponse contains the response from method ContainerAppsSourceControlsClient.ListByContainerApp. +type ContainerAppsSourceControlsClientListByContainerAppResponse struct { + SourceControlCollection +} + +// DaprComponentsClientCreateOrUpdateResponse contains the response from method DaprComponentsClient.CreateOrUpdate. +type DaprComponentsClientCreateOrUpdateResponse struct { + DaprComponent +} + +// DaprComponentsClientDeleteResponse contains the response from method DaprComponentsClient.Delete. +type DaprComponentsClientDeleteResponse struct { + // placeholder for future response values +} + +// DaprComponentsClientGetResponse contains the response from method DaprComponentsClient.Get. +type DaprComponentsClientGetResponse struct { + DaprComponent +} + +// DaprComponentsClientListResponse contains the response from method DaprComponentsClient.List. +type DaprComponentsClientListResponse struct { + DaprComponentsCollection +} + +// DaprComponentsClientListSecretsResponse contains the response from method DaprComponentsClient.ListSecrets. +type DaprComponentsClientListSecretsResponse struct { + DaprSecretsCollection +} + +// ManagedEnvironmentDiagnosticsClientGetDetectorResponse contains the response from method ManagedEnvironmentDiagnosticsClient.GetDetector. +type ManagedEnvironmentDiagnosticsClientGetDetectorResponse struct { + Diagnostics +} + +// ManagedEnvironmentDiagnosticsClientListDetectorsResponse contains the response from method ManagedEnvironmentDiagnosticsClient.ListDetectors. +type ManagedEnvironmentDiagnosticsClientListDetectorsResponse struct { + DiagnosticsCollection +} + +// ManagedEnvironmentsClientCreateOrUpdateResponse contains the response from method ManagedEnvironmentsClient.CreateOrUpdate. +type ManagedEnvironmentsClientCreateOrUpdateResponse struct { + ManagedEnvironment +} + +// ManagedEnvironmentsClientDeleteResponse contains the response from method ManagedEnvironmentsClient.Delete. +type ManagedEnvironmentsClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedEnvironmentsClientGetResponse contains the response from method ManagedEnvironmentsClient.Get. +type ManagedEnvironmentsClientGetResponse struct { + ManagedEnvironment +} + +// ManagedEnvironmentsClientListByResourceGroupResponse contains the response from method ManagedEnvironmentsClient.ListByResourceGroup. +type ManagedEnvironmentsClientListByResourceGroupResponse struct { + ManagedEnvironmentsCollection +} + +// ManagedEnvironmentsClientListBySubscriptionResponse contains the response from method ManagedEnvironmentsClient.ListBySubscription. +type ManagedEnvironmentsClientListBySubscriptionResponse struct { + ManagedEnvironmentsCollection +} + +// ManagedEnvironmentsClientUpdateResponse contains the response from method ManagedEnvironmentsClient.Update. +type ManagedEnvironmentsClientUpdateResponse struct { + // placeholder for future response values +} + +// ManagedEnvironmentsDiagnosticsClientGetRootResponse contains the response from method ManagedEnvironmentsDiagnosticsClient.GetRoot. +type ManagedEnvironmentsDiagnosticsClientGetRootResponse struct { + ManagedEnvironment +} + +// ManagedEnvironmentsStoragesClientCreateOrUpdateResponse contains the response from method ManagedEnvironmentsStoragesClient.CreateOrUpdate. +type ManagedEnvironmentsStoragesClientCreateOrUpdateResponse struct { + ManagedEnvironmentStorage +} + +// ManagedEnvironmentsStoragesClientDeleteResponse contains the response from method ManagedEnvironmentsStoragesClient.Delete. +type ManagedEnvironmentsStoragesClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedEnvironmentsStoragesClientGetResponse contains the response from method ManagedEnvironmentsStoragesClient.Get. +type ManagedEnvironmentsStoragesClientGetResponse struct { + ManagedEnvironmentStorage +} + +// ManagedEnvironmentsStoragesClientListResponse contains the response from method ManagedEnvironmentsStoragesClient.List. +type ManagedEnvironmentsStoragesClientListResponse struct { + ManagedEnvironmentStoragesCollection +} + +// NamespacesClientCheckNameAvailabilityResponse contains the response from method NamespacesClient.CheckNameAvailability. +type NamespacesClientCheckNameAvailabilityResponse struct { + CheckNameAvailabilityResponse +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + AvailableOperations +} diff --git a/sdk/resourcemanager/app/armapp/time_rfc3339.go b/sdk/resourcemanager/app/armapp/time_rfc3339.go new file mode 100644 index 000000000000..3d144791a824 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/time_rfc3339.go @@ -0,0 +1,87 @@ +//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 armapp + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +}