From b6c14146070c547d290d2ba536d09201d666963f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 13 Apr 2022 18:58:18 +0000 Subject: [PATCH] CodeGen from PR 18678 in Azure/azure-rest-api-specs Merge a4391f4a4cf6459cd73f238545dc2df4209e9de1 into bbd44410581ae5aed9ef0dcb3ad8f22a6c0dd670 --- sdk/resourcemanager/app/armapp/CHANGELOG.md | 5 + 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 + sdk/resourcemanager/app/armapp/ci.yml | 28 + sdk/resourcemanager/app/armapp/go.mod | 11 + sdk/resourcemanager/app/armapp/go.sum | 32 + .../zz_generated_certificates_client.go | 359 +++ .../app/armapp/zz_generated_constants.go | 394 ++++ .../zz_generated_containerapps_client.go | 533 +++++ ...nerated_containerappsauthconfigs_client.go | 299 +++ ...ed_containerappsrevisionreplicas_client.go | 182 ++ ...generated_containerappsrevisions_client.go | 344 +++ ...ated_containerappssourcecontrols_client.go | 318 +++ .../zz_generated_daprcomponents_client.go | 357 +++ ...zz_generated_managedenvironments_client.go | 418 ++++ ...ated_managedenvironmentsstorages_client.go | 286 +++ .../app/armapp/zz_generated_models.go | 1920 +++++++++++++++++ .../app/armapp/zz_generated_models_serde.go | 650 ++++++ .../armapp/zz_generated_namespaces_client.go | 112 + .../armapp/zz_generated_operations_client.go | 103 + .../app/armapp/zz_generated_response_types.go | 234 ++ .../app/armapp/zz_generated_time_rfc3339.go | 85 + 24 files changed, 6788 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/ci.yml 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/zz_generated_certificates_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_constants.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_containerapps_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_containerappsauthconfigs_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_containerappsrevisionreplicas_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_containerappsrevisions_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_containerappssourcecontrols_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_daprcomponents_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_managedenvironments_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_managedenvironmentsstorages_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_models.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_models_serde.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_namespaces_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_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..22b323e62999 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2022-04-13) + +- Init release. \ 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..3b1937619211 --- /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.18 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.NewContainerAppsClient(, 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.NewContainerAppsClient(, 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..c4b8c4417f26 --- /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.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/app/armapp + +package armapp 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/go.mod b/sdk/resourcemanager/app/armapp/go.mod new file mode 100644 index 000000000000..0298871eaa08 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/app/armapp + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + golang.org/x/net v0.0.0-20210610132358-84b48f89b13b // indirect + golang.org/x/text v0.3.6 // indirect +) diff --git a/sdk/resourcemanager/app/armapp/go.sum b/sdk/resourcemanager/app/armapp/go.sum new file mode 100644 index 000000000000..a7eaa30576c1 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/go.sum @@ -0,0 +1,32 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/app/armapp/zz_generated_certificates_client.go b/sdk/resourcemanager/app/armapp/zz_generated_certificates_client.go new file mode 100644 index 000000000000..5951bb220136 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_certificates_client.go @@ -0,0 +1,359 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// managedEnvironmentName - Name of the Managed Environment. +// name - Name of the Certificate. +// options - CertificatesClientCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.CreateOrUpdate +// method. +func (client *CertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedEnvironmentName string, name string, options *CertificatesClientCreateOrUpdateOptions) (CertificatesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedEnvironmentName, name, 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, managedEnvironmentName string, name string, options *CertificatesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}" + 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 managedEnvironmentName == "" { + return nil, errors.New("parameter managedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedEnvironmentName}", url.PathEscape(managedEnvironmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// managedEnvironmentName - Name of the Managed Environment. +// name - Name of the Certificate. +// options - CertificatesClientDeleteOptions contains the optional parameters for the CertificatesClient.Delete method. +func (client *CertificatesClient) Delete(ctx context.Context, resourceGroupName string, managedEnvironmentName string, name string, options *CertificatesClientDeleteOptions) (CertificatesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedEnvironmentName, name, 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, managedEnvironmentName string, name string, options *CertificatesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}" + 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 managedEnvironmentName == "" { + return nil, errors.New("parameter managedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedEnvironmentName}", url.PathEscape(managedEnvironmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Get the specified Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// managedEnvironmentName - Name of the Managed Environment. +// name - Name of the Certificate. +// options - CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. +func (client *CertificatesClient) Get(ctx context.Context, resourceGroupName string, managedEnvironmentName string, name string, options *CertificatesClientGetOptions) (CertificatesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, managedEnvironmentName, name, 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, managedEnvironmentName string, name string, options *CertificatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}" + 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 managedEnvironmentName == "" { + return nil, errors.New("parameter managedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedEnvironmentName}", url.PathEscape(managedEnvironmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// List - Get the Certificates in a given managed environment. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// managedEnvironmentName - Name of the Managed Environment. +// options - CertificatesClientListOptions contains the optional parameters for the CertificatesClient.List method. +func (client *CertificatesClient) List(resourceGroupName string, managedEnvironmentName string, options *CertificatesClientListOptions) *runtime.Pager[CertificatesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[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, managedEnvironmentName, 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, managedEnvironmentName string, options *CertificatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/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 managedEnvironmentName == "" { + return nil, errors.New("parameter managedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedEnvironmentName}", url.PathEscape(managedEnvironmentName)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// managedEnvironmentName - Name of the Managed Environment. +// name - 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, managedEnvironmentName string, name string, certificateEnvelope CertificatePatch, options *CertificatesClientUpdateOptions) (CertificatesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, managedEnvironmentName, name, 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, managedEnvironmentName string, name string, certificateEnvelope CertificatePatch, options *CertificatesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}" + 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 managedEnvironmentName == "" { + return nil, errors.New("parameter managedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedEnvironmentName}", url.PathEscape(managedEnvironmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/zz_generated_constants.go b/sdk/resourcemanager/app/armapp/zz_generated_constants.go new file mode 100644 index 000000000000..361e17b4d617 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_constants.go @@ -0,0 +1,394 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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, + } +} + +// 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, + } +} + +// ContainerAppProvisioningState - Provisioning state of the Container App. +type ContainerAppProvisioningState string + +const ( + ContainerAppProvisioningStateCanceled ContainerAppProvisioningState = "Canceled" + 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, + 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, + } +} + +// 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" +) + +// PossibleIngressTransportMethodValues returns the possible values for the IngressTransportMethod const type. +func PossibleIngressTransportMethodValues() []IngressTransportMethod { + return []IngressTransportMethod{ + IngressTransportMethodAuto, + IngressTransportMethodHTTP, + IngressTransportMethodHTTP2, + } +} + +// 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, + } +} + +// 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/zz_generated_containerapps_client.go b/sdk/resourcemanager/app/armapp/zz_generated_containerapps_client.go new file mode 100644 index 000000000000..18cc6b171109 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerapps_client.go @@ -0,0 +1,533 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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 - Description for Create or update a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - 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, name string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[ContainerAppsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, name, containerAppEnvelope, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ContainerAppsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ContainerAppsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Description for Create or update a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ContainerAppsClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, name, 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, name string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, containerAppEnvelope) +} + +// BeginDelete - Description for Delete a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - 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, name string, options *ContainerAppsClientBeginDeleteOptions) (*armruntime.Poller[ContainerAppsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, name, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ContainerAppsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ContainerAppsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Description for Delete a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ContainerAppsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, options *ContainerAppsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, 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, name string, options *ContainerAppsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Get the properties of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - 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, name string, options *ContainerAppsClientGetOptions) (ContainerAppsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, name, 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, name string, options *ContainerAppsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// ListByResourceGroup - Get the Container Apps in a given resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// 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) ListByResourceGroup(resourceGroupName string, options *ContainerAppsClientListByResourceGroupOptions) *runtime.Pager[ContainerAppsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// ListBySubscription - Get the Container Apps in a given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// options - ContainerAppsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsClient.ListBySubscription +// method. +func (client *ContainerAppsClient) ListBySubscription(options *ContainerAppsClientListBySubscriptionOptions) *runtime.Pager[ContainerAppsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - 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, name string, options *ContainerAppsClientListSecretsOptions) (ContainerAppsClientListSecretsResponse, error) { + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, name, 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, name string, options *ContainerAppsClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}/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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - 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, name string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginUpdateOptions) (*armruntime.Poller[ContainerAppsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, name, containerAppEnvelope, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ContainerAppsClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.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. +func (client *ContainerAppsClient) update(ctx context.Context, resourceGroupName string, name string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, name, 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, name string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, containerAppEnvelope) +} diff --git a/sdk/resourcemanager/app/armapp/zz_generated_containerappsauthconfigs_client.go b/sdk/resourcemanager/app/armapp/zz_generated_containerappsauthconfigs_client.go new file mode 100644 index 000000000000..26273c3f49f1 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerappsauthconfigs_client.go @@ -0,0 +1,299 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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 - Description for Create or update the AuthConfig for a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, authConfigEnvelope AuthConfig, options *ContainerAppsAuthConfigsClientCreateOrUpdateOptions) (ContainerAppsAuthConfigsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, authConfigEnvelope AuthConfig, options *ContainerAppsAuthConfigsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 - Description for Delete a Container App AuthConfig. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, options *ContainerAppsAuthConfigsClientDeleteOptions) (ContainerAppsAuthConfigsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, options *ContainerAppsAuthConfigsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Get a AuthConfig of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, options *ContainerAppsAuthConfigsClientGetOptions) (ContainerAppsAuthConfigsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, options *ContainerAppsAuthConfigsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// ListByContainerApp - Get the Container App AuthConfigs in a given resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// 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) ListByContainerApp(resourceGroupName string, containerAppName string, options *ContainerAppsAuthConfigsClientListByContainerAppOptions) *runtime.Pager[ContainerAppsAuthConfigsClientListByContainerAppResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/zz_generated_containerappsrevisionreplicas_client.go b/sdk/resourcemanager/app/armapp/zz_generated_containerappsrevisionreplicas_client.go new file mode 100644 index 000000000000..64d3e266571c --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerappsrevisionreplicas_client.go @@ -0,0 +1,182 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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. +// 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. +// name - 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, name string, options *ContainerAppsRevisionReplicasClientGetReplicaOptions) (ContainerAppsRevisionReplicasClientGetReplicaResponse, error) { + req, err := client.getReplicaCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, name, 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, name string, options *ContainerAppsRevisionReplicasClientGetReplicaOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/zz_generated_containerappsrevisions_client.go b/sdk/resourcemanager/app/armapp/zz_generated_containerappsrevisions_client.go new file mode 100644 index 000000000000..0d3d292d396e --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerappsrevisions_client.go @@ -0,0 +1,344 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, options *ContainerAppsRevisionsClientActivateRevisionOptions) (ContainerAppsRevisionsClientActivateRevisionResponse, error) { + req, err := client.activateRevisionCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, options *ContainerAppsRevisionsClientActivateRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// DeactivateRevision - Deactivates a revision for a Container App +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, options *ContainerAppsRevisionsClientDeactivateRevisionOptions) (ContainerAppsRevisionsClientDeactivateRevisionResponse, error) { + req, err := client.deactivateRevisionCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, options *ContainerAppsRevisionsClientDeactivateRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// GetRevision - Get a revision of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, options *ContainerAppsRevisionsClientGetRevisionOptions) (ContainerAppsRevisionsClientGetRevisionResponse, error) { + req, err := client.getRevisionCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, options *ContainerAppsRevisionsClientGetRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// ListRevisions - Get the Revisions for a given Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// 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) ListRevisions(resourceGroupName string, containerAppName string, options *ContainerAppsRevisionsClientListRevisionsOptions) *runtime.Pager[ContainerAppsRevisionsClientListRevisionsResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, options *ContainerAppsRevisionsClientRestartRevisionOptions) (ContainerAppsRevisionsClientRestartRevisionResponse, error) { + req, err := client.restartRevisionCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, options *ContainerAppsRevisionsClientRestartRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} diff --git a/sdk/resourcemanager/app/armapp/zz_generated_containerappssourcecontrols_client.go b/sdk/resourcemanager/app/armapp/zz_generated_containerappssourcecontrols_client.go new file mode 100644 index 000000000000..d360f4d7a328 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerappssourcecontrols_client.go @@ -0,0 +1,318 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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 - Description for Create or update the SourceControl for a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, sourceControlEnvelope SourceControl, options *ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[ContainerAppsSourceControlsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, containerAppName, name, sourceControlEnvelope, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ContainerAppsSourceControlsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ContainerAppsSourceControlsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Description for Create or update the SourceControl for a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ContainerAppsSourceControlsClient) createOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, name string, sourceControlEnvelope SourceControl, options *ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, containerAppName, name, 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.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ContainerAppsSourceControlsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, name string, sourceControlEnvelope SourceControl, options *ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, sourceControlEnvelope) +} + +// BeginDelete - Description for Delete a Container App SourceControl. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, options *ContainerAppsSourceControlsClientBeginDeleteOptions) (*armruntime.Poller[ContainerAppsSourceControlsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, containerAppName, name, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ContainerAppsSourceControlsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ContainerAppsSourceControlsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Description for Delete a Container App SourceControl. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ContainerAppsSourceControlsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, name string, options *ContainerAppsSourceControlsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, options *ContainerAppsSourceControlsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Get a SourceControl of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// containerAppName - Name of the Container App. +// name - 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, name string, options *ContainerAppsSourceControlsClientGetOptions) (ContainerAppsSourceControlsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, containerAppName, name, 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, name string, options *ContainerAppsSourceControlsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// ListByContainerApp - Get the Container App SourceControls in a given resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// 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) ListByContainerApp(resourceGroupName string, containerAppName string, options *ContainerAppsSourceControlsClientListByContainerAppOptions) *runtime.Pager[ContainerAppsSourceControlsClientListByContainerAppResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/zz_generated_daprcomponents_client.go b/sdk/resourcemanager/app/armapp/zz_generated_daprcomponents_client.go new file mode 100644 index 000000000000..ad9b8b8a8fb6 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_daprcomponents_client.go @@ -0,0 +1,357 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// name - 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, name string, daprComponentEnvelope DaprComponent, options *DaprComponentsClientCreateOrUpdateOptions) (DaprComponentsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, name, 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, name string, daprComponentEnvelope DaprComponent, options *DaprComponentsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// name - 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, name string, options *DaprComponentsClientDeleteOptions) (DaprComponentsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, name, 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, name string, options *DaprComponentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Get a dapr component. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// name - 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, name string, options *DaprComponentsClientGetOptions) (DaprComponentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, environmentName, name, 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, name string, options *DaprComponentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// List - Get the Dapr Components for a managed environment. +// If the operation fails it returns an *azcore.ResponseError type. +// 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) List(resourceGroupName string, environmentName string, options *DaprComponentsClientListOptions) *runtime.Pager[DaprComponentsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// environmentName - Name of the Managed Environment. +// name - 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, name string, options *DaprComponentsClientListSecretsOptions) (DaprComponentsClientListSecretsResponse, error) { + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, environmentName, name, 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, name string, options *DaprComponentsClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}/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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/zz_generated_managedenvironments_client.go b/sdk/resourcemanager/app/armapp/zz_generated_managedenvironments_client.go new file mode 100644 index 000000000000..933fd8c7f6e7 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_managedenvironments_client.go @@ -0,0 +1,418 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - 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, name string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[ManagedEnvironmentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, name, environmentEnvelope, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ManagedEnvironmentsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.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. +func (client *ManagedEnvironmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, name, 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, name string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - Name of the Environment. +// options - ManagedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginDelete +// method. +func (client *ManagedEnvironmentsClient) BeginDelete(ctx context.Context, resourceGroupName string, name string, options *ManagedEnvironmentsClientBeginDeleteOptions) (*armruntime.Poller[ManagedEnvironmentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, name, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ManagedEnvironmentsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.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. +func (client *ManagedEnvironmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, options *ManagedEnvironmentsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, 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, name string, options *ManagedEnvironmentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - Name of the Environment. +// options - ManagedEnvironmentsClientGetOptions contains the optional parameters for the ManagedEnvironmentsClient.Get method. +func (client *ManagedEnvironmentsClient) Get(ctx context.Context, resourceGroupName string, name string, options *ManagedEnvironmentsClientGetOptions) (ManagedEnvironmentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, name, 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, name string, options *ManagedEnvironmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// ListByResourceGroup - Get all the Managed Environments in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// 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) ListByResourceGroup(resourceGroupName string, options *ManagedEnvironmentsClientListByResourceGroupOptions) *runtime.Pager[ManagedEnvironmentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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 +} + +// ListBySubscription - Get all Managed Environments for a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// options - ManagedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ManagedEnvironmentsClient.ListBySubscription +// method. +func (client *ManagedEnvironmentsClient) ListBySubscription(options *ManagedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ManagedEnvironmentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - 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, name string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginUpdateOptions) (*armruntime.Poller[ManagedEnvironmentsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, name, environmentEnvelope, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ManagedEnvironmentsClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.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. +func (client *ManagedEnvironmentsClient) update(ctx context.Context, resourceGroupName string, name string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, name, 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, name string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, environmentEnvelope) +} diff --git a/sdk/resourcemanager/app/armapp/zz_generated_managedenvironmentsstorages_client.go b/sdk/resourcemanager/app/armapp/zz_generated_managedenvironmentsstorages_client.go new file mode 100644 index 000000000000..7ef937564420 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_managedenvironmentsstorages_client.go @@ -0,0 +1,286 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// envName - Name of the Environment. +// name - 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, envName string, name string, storageEnvelope ManagedEnvironmentStorage, options *ManagedEnvironmentsStoragesClientCreateOrUpdateOptions) (ManagedEnvironmentsStoragesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, envName, name, 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, envName string, name string, storageEnvelope ManagedEnvironmentStorage, options *ManagedEnvironmentsStoragesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}" + 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 envName == "" { + return nil, errors.New("parameter envName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{envName}", url.PathEscape(envName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// envName - Name of the Environment. +// name - Name of the storage. +// options - ManagedEnvironmentsStoragesClientDeleteOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.Delete +// method. +func (client *ManagedEnvironmentsStoragesClient) Delete(ctx context.Context, resourceGroupName string, envName string, name string, options *ManagedEnvironmentsStoragesClientDeleteOptions) (ManagedEnvironmentsStoragesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, envName, name, 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, envName string, name string, options *ManagedEnvironmentsStoragesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}" + 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 envName == "" { + return nil, errors.New("parameter envName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{envName}", url.PathEscape(envName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Get storage for a managedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// envName - Name of the Environment. +// name - Name of the storage. +// options - ManagedEnvironmentsStoragesClientGetOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.Get +// method. +func (client *ManagedEnvironmentsStoragesClient) Get(ctx context.Context, resourceGroupName string, envName string, name string, options *ManagedEnvironmentsStoragesClientGetOptions) (ManagedEnvironmentsStoragesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, envName, name, 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, envName string, name string, options *ManagedEnvironmentsStoragesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}" + 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 envName == "" { + return nil, errors.New("parameter envName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{envName}", url.PathEscape(envName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// envName - Name of the Environment. +// options - ManagedEnvironmentsStoragesClientListOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.List +// method. +func (client *ManagedEnvironmentsStoragesClient) List(ctx context.Context, resourceGroupName string, envName string, options *ManagedEnvironmentsStoragesClientListOptions) (ManagedEnvironmentsStoragesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, envName, 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, envName string, options *ManagedEnvironmentsStoragesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/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 envName == "" { + return nil, errors.New("parameter envName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{envName}", url.PathEscape(envName)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/zz_generated_models.go b/sdk/resourcemanager/app/armapp/zz_generated_models.go new file mode 100644 index 000000000000..b28252249e74 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_models.go @@ -0,0 +1,1920 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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"` +} + +// 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 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"` + + // 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"` +} + +// 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"` + + // 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 *string `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 the Container App's environment. + ManagedEnvironmentID *string `json:"managedEnvironmentId,omitempty"` + + // Container App versioned application definition. + Template *Template `json:"template,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 +} + +// 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"` +} + +// CustomHostnameAnalysisResult - Custom domain analysis. +type CustomHostnameAnalysisResult struct { + // CustomHostnameAnalysisResult resource specific properties + Properties *CustomHostnameAnalysisResultProperties `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"` +} + +// CustomHostnameAnalysisResultProperties - CustomHostnameAnalysisResult resource specific properties +type CustomHostnameAnalysisResultProperties 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 *DefaultErrorResponse `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"` +} + +// 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"` + + // Boolean indicating if the Dapr side car is enabled + Enabled *bool `json:"enabled,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"` + + // 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"` +} + +// 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"` +} + +// 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 Custom 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"` +} + +// 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"` + + // Bool indicating if app exposes an external http endpoint + External *bool `json:"external,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"` +} + +// 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"` + + // 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"` +} + +// 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"` + + // 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"` + + // 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"` +} + +// 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"` +} + +// 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"` +} + +// 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"` + + // 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, must provide ControlPlaneSubnetResourceId and AppSubnetResourceId 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"` +} diff --git a/sdk/resourcemanager/app/armapp/zz_generated_models_serde.go b/sdk/resourcemanager/app/armapp/zz_generated_models_serde.go new file mode 100644 index 000000000000..0658410de24d --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_models_serde.go @@ -0,0 +1,650 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armapp + +import ( + "encoding/json" + "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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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, "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 err + } + for key, val := range rawMsg { + var err error + switch key { + case "expirationDate": + err = unpopulateTimeRFC3339(val, &c.ExpirationDate) + delete(rawMsg, key) + case "issueDate": + err = unpopulateTimeRFC3339(val, &c.IssueDate) + delete(rawMsg, key) + case "issuer": + err = unpopulate(val, &c.Issuer) + delete(rawMsg, key) + case "password": + err = unpopulate(val, &c.Password) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &c.ProvisioningState) + delete(rawMsg, key) + case "publicKeyHash": + err = unpopulate(val, &c.PublicKeyHash) + delete(rawMsg, key) + case "subjectName": + err = unpopulate(val, &c.SubjectName) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, &c.Thumbprint) + delete(rawMsg, key) + case "valid": + err = unpopulate(val, &c.Valid) + delete(rawMsg, key) + case "value": + err = runtime.DecodeByteArray(string(val), &c.Value, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return 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, "registries", c.Registries) + populate(objectMap, "secrets", c.Secrets) + return json.Marshal(objectMap) +} + +// 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) +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerApp. +func (c ContainerApp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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) +} + +// 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) +} + +// 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) +} + +// 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, "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) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CustomHostnameAnalysisResultProperties. +func (c CustomHostnameAnalysisResultProperties) 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) +} + +// 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) +} + +// 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, "secrets", d.Secrets) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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, "external", i.External) + populate(objectMap, "fqdn", i.Fqdn) + populate(objectMap, "targetPort", i.TargetPort) + populate(objectMap, "traffic", i.Traffic) + populate(objectMap, "transport", i.Transport) + return json.Marshal(objectMap) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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) +} + +// 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 err + } + for key, val := range rawMsg { + var err error + switch key { + case "containers": + err = unpopulate(val, &r.Containers) + delete(rawMsg, key) + case "createdTime": + err = unpopulateTimeRFC3339(val, &r.CreatedTime) + delete(rawMsg, key) + } + if err != nil { + return 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) +} + +// 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 err + } + for key, val := range rawMsg { + var err error + switch key { + case "active": + err = unpopulate(val, &r.Active) + delete(rawMsg, key) + case "createdTime": + err = unpopulateTimeRFC3339(val, &r.CreatedTime) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, &r.Fqdn) + delete(rawMsg, key) + case "healthState": + err = unpopulate(val, &r.HealthState) + delete(rawMsg, key) + case "provisioningError": + err = unpopulate(val, &r.ProvisioningError) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &r.ProvisioningState) + delete(rawMsg, key) + case "replicas": + err = unpopulate(val, &r.Replicas) + delete(rawMsg, key) + case "template": + err = unpopulate(val, &r.Template) + delete(rawMsg, key) + case "trafficWeight": + err = unpopulate(val, &r.TrafficWeight) + delete(rawMsg, key) + } + if err != nil { + return 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) +} + +// 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) +} + +// 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) +} + +// 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 err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return 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, "revisionSuffix", t.RevisionSuffix) + populate(objectMap, "scale", t.Scale) + populate(objectMap, "volumes", t.Volumes) + return json.Marshal(objectMap) +} + +// 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) +} + +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, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/app/armapp/zz_generated_namespaces_client.go b/sdk/resourcemanager/app/armapp/zz_generated_namespaces_client.go new file mode 100644 index 000000000000..72a5e88729ee --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_namespaces_client.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// managedEnvironmentName - 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, managedEnvironmentName string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *NamespacesClientCheckNameAvailabilityOptions) (NamespacesClientCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, managedEnvironmentName, 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, managedEnvironmentName string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *NamespacesClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/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 managedEnvironmentName == "" { + return nil, errors.New("parameter managedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedEnvironmentName}", url.PathEscape(managedEnvironmentName)) + 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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/zz_generated_operations_client.go b/sdk/resourcemanager/app/armapp/zz_generated_operations_client.go new file mode 100644 index 000000000000..241a823c3272 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_operations_client.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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.AzurePublicCloud.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 +} + +// List - Lists all of the available RP operations. +// If the operation fails it returns an *azcore.ResponseError type. +// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[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-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/zz_generated_response_types.go b/sdk/resourcemanager/app/armapp/zz_generated_response_types.go new file mode 100644 index 000000000000..f46d23fa1f16 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_response_types.go @@ -0,0 +1,234 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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/zz_generated_time_rfc3339.go b/sdk/resourcemanager/app/armapp/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..5a5b55e9f28e --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armapp + +import ( + "encoding/json" + "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, 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 err + } + *t = (*time.Time)(&aux) + return nil +}