From 7d281cd8f4ba5b2816935ac1f1cd34ac5919e63e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 16 Feb 2022 03:17:03 +0000 Subject: [PATCH] CodeGen from PR 17820 in Azure/azure-rest-api-specs Microsoft.App version 2022-01-01-preview (#17820) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * New Swagger Spec File * New Swagger Example Spec File * New Readme Config File * New Azure AZ Readme Config File * New Azure CLI Readme Config File * New Go Language Readme Config File * New Python Language Readme Config File * New Typescript Language Readme Config File * New C# Language Readme Config File * Adding new API version 2022-01-01-preview for the new service Microsoft.App (#17135) * Adding swagger and examples * Fix samples * Fix linting errors * fix errors * fix more errors * prettier fixes * Fix the VNET properties * fix the vnet props * Attempt to remove x-ms-identifiers * Add x-ms-identifiers back * Revert "Add x-ms-identifiers back" This reverts commit 44525ab5ace45d9cb1bc85bee2751f015dcaffc6. * Addsourcecontrolapis (#17287) * add sourcecontrol apis * remove space * prettier fix * typo * avocado fix * lint fix * add replicas apis (#17501) * Remove Dapr components from ContainerApp spec. Not breaking because the version hasn't been released yet. (#17479) * Remove dapr components from the ContainerApp object * Fix example * add descriptions * fix * change the auto-rest parameters * Support volume mounts for containerApp (#17530) * add volume mounts * add identifier * refine volume definition * Fix samples (#17534) * Adding managed identity (#17569) * Adding managed identity * prettier fix. * Microsof.app 2022 01 01 preview/add custom domains (#17385) * add support for Custom domains and certificates * add Certificates * Ccertificate as child resource of Managed Env. * Support default custom domain * PUT/DELETE certificate are not long-running * Add Custom Domain Verification Id * domains for all revisions and adding examples * missing examples * one more missing example * Examples+missing paths * Adding missing envelope properties * Addressing PR comments * Removing AKV and Free cert related properties * Prettier and semantic validation fixes * Fixing semantic validations and examples * More fixes * Addressing more PR comments * Updating examples * fixing type * fixing types * Extra properties and responses * misplaced response * whitespace * fix security section * fixing ManageEnvironment securityDefinitions * add 204 delete response * Removing virtual IP and IP Based option * change modelAsString * Addressing ARM PR comments * Removing 404 response from example * renaming custom hostname analysis operation * mark certificate as tracked resource * fix sample * Use Certificate Id instead of Certificate name Co-authored-by: Ruslan Yakushev 🚴 Co-authored-by: vinisoto * Add new properties for ContainerApp (#17483) * add ephemeral storage * add outbound ip * add listsecrets * fix CI * fix example * fix * add identifier * fix * add example * mars as secret * Add storages operation for managedEnvironment (#17545) * add storage * fix * fix typo * Add EasyAuth configuration APIs for ContainerApp (#17492) * Add Easy Auth Config related APIs for ContainerApp * Use common type ProxyResource * Update description * update per validation * typo fix * fix validation error * Update sample and description * Update because ARM prefer string than boolean * Add static web identity provider * Add container probes (#17535) * Add container probes * minor fix * Use execute instead of exec'd, add identifier * remove exec from preview * use integer instead of intorstring * Add `internal` property under VnetConfiguration for internalOnly environments (#17656) * Add internal property under VnetConfiguration for internalOnly environments * Update examples * Add Dapr Components collection APIs (#17552) * Add daprComponents * update readme * Fix linting errors * More lint fixes * prettier fixes * make dapr component a tracked resource * fix the patch * fix lint errors * Revert "fix lint errors" This reverts commit 045f1d94bddf3527eab98b7a376070ab30fdd760. * Revert "fix the patch" This reverts commit 14521103e848e09762185f832c0270c16ed16efd. * Revert "make dapr component a tracked resource" This reverts commit 239268eda070ff37f26e8a772adacdd26bbf0937. * Fix linter issues * fix wrong fix * fix linter * fix the operationids (#17809) * correct resource name (#17846) * Add custom open id providers support (#17855) * Add custom open id providers support * Update description Co-authored-by: Xingjian Wang <79332479+xwang971@users.noreply.github.com> Co-authored-by: Zunli Hu Co-authored-by: Vaclav Turecek Co-authored-by: Vini Soto <18271663+vinisoto@users.noreply.github.com> Co-authored-by: vinisoto Co-authored-by: erich-wang Co-authored-by: Mike Vu Co-authored-by: Sanchit Mehta --- sdk/resourcemanager/app/armapp/CHANGELOG.md | 5 + sdk/resourcemanager/app/armapp/LICENSE.txt | 21 + sdk/resourcemanager/app/armapp/README.md | 75 + sdk/resourcemanager/app/armapp/autorest.md | 13 + sdk/resourcemanager/app/armapp/build.go | 7 + sdk/resourcemanager/app/armapp/ci.yml | 27 + sdk/resourcemanager/app/armapp/go.mod | 8 + sdk/resourcemanager/app/armapp/go.sum | 37 + .../app/armapp/go_mod_tidy_hack.go | 13 + .../zz_generated_certificates_client.go | 338 +++ .../app/armapp/zz_generated_constants.go | 509 ++++ .../zz_generated_containerapps_client.go | 502 ++++ ...nerated_containerappsauthconfigs_client.go | 278 ++ ...ed_containerappsrevisionreplicas_client.go | 177 ++ ...generated_containerappsrevisions_client.go | 320 +++ ...ated_containerappssourcecontrols_client.go | 309 +++ .../zz_generated_daprcomponents_client.go | 275 ++ ...zz_generated_managedenvironments_client.go | 388 +++ ...ated_managedenvironmentsstorages_client.go | 281 ++ .../app/armapp/zz_generated_models.go | 2395 +++++++++++++++++ .../armapp/zz_generated_operations_client.go | 82 + .../app/armapp/zz_generated_pagers.go | 557 ++++ .../app/armapp/zz_generated_pollers.go | 273 ++ .../app/armapp/zz_generated_response_types.go | 712 +++++ .../app/armapp/zz_generated_time_rfc3339.go | 85 + 25 files changed, 7687 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/go_mod_tidy_hack.go 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_operations_client.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/app/armapp/zz_generated_pollers.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..e54035933ac2 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2022-02-16) + +- 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..9f1e1dcbe0e8 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/README.md @@ -0,0 +1,75 @@ +# 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.16 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 := armapp.NewCertificatesClient(, 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{ + Host: arm.AzureChina, +} +client := armapp.NewCertificatesClient(, 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..fda14ee0771f --- /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: +- /home/vsts/work/1/s/azure-rest-api-specs/specification/app/resource-manager/readme.md +- /home/vsts/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..15b91dd86eb6 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/ci.yml @@ -0,0 +1,27 @@ +# 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: + 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..7cd48ec2b6ad --- /dev/null +++ b/sdk/resourcemanager/app/armapp/go.mod @@ -0,0 +1,8 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/app/armapp + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v61.5.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 +) diff --git a/sdk/resourcemanager/app/armapp/go.sum b/sdk/resourcemanager/app/armapp/go.sum new file mode 100644 index 000000000000..621181783406 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/go.sum @@ -0,0 +1,37 @@ +github.com/Azure/azure-sdk-for-go v61.5.0+incompatible h1:OSHSFeNm7D1InGsQrFjyN9hpxD5Ec60PdsWWudCpah4= +github.com/Azure/azure-sdk-for-go v61.5.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/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/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +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/go_mod_tidy_hack.go b/sdk/resourcemanager/app/armapp/go_mod_tidy_hack.go new file mode 100644 index 000000000000..d44c84e1a174 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/go_mod_tidy_hack.go @@ -0,0 +1,13 @@ +//go:build modhack +// +build modhack + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of +// the resultant binary. + +package armapp + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "github.com/Azure/azure-sdk-for-go" 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..aef6b9b476e0 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_certificates_client.go @@ -0,0 +1,338 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &CertificatesClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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{RawResponse: resp}, 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-01-01-preview") + 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-01-01-preview") + 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{RawResponse: resp} + 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) *CertificatesClientListPager { + return &CertificatesClientListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, managedEnvironmentName, options) + }, + advancer: func(ctx context.Context, resp CertificatesClientListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CertificateCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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-01-01-preview") + 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{RawResponse: resp} + 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..112ae698bf11 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_constants.go @@ -0,0 +1,509 @@ +//go:build go1.16 +// +build go1.16 + +// 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, + } +} + +// ToPtr returns a *AccessMode pointing to the current value. +func (c AccessMode) ToPtr() *AccessMode { + return &c +} + +// ActiveRevisionsMode - ActiveRevisionsMode controls how active revisions are handled for the Container app:Multiple: multiple +// revisions can be active. If no value if provided, this is the defaultSingle: Only one revision +// can be active at a time. Revision weights can not be used in this mode +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, + } +} + +// ToPtr returns a *ActiveRevisionsMode pointing to the current value. +func (c ActiveRevisionsMode) ToPtr() *ActiveRevisionsMode { + return &c +} + +// 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, + } +} + +// ToPtr returns a *AppProtocol pointing to the current value. +func (c AppProtocol) ToPtr() *AppProtocol { + return &c +} + +// 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, + } +} + +// ToPtr returns a *BindingType pointing to the current value. +func (c BindingType) ToPtr() *BindingType { + return &c +} + +// 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, + } +} + +// ToPtr returns a *ContainerAppProvisioningState pointing to the current value. +func (c ContainerAppProvisioningState) ToPtr() *ContainerAppProvisioningState { + return &c +} + +// 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, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +// 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, + } +} + +// ToPtr returns a *DNSVerificationTestResult pointing to the current value. +func (c DNSVerificationTestResult) ToPtr() *DNSVerificationTestResult { + return &c +} + +// DisableWwwAuthenticateMode - true if the www-authenticate provider should be omitted from the request; otherwise, false. +type DisableWwwAuthenticateMode string + +const ( + DisableWwwAuthenticateModeFalse DisableWwwAuthenticateMode = "False" + DisableWwwAuthenticateModeTrue DisableWwwAuthenticateMode = "True" +) + +// PossibleDisableWwwAuthenticateModeValues returns the possible values for the DisableWwwAuthenticateMode const type. +func PossibleDisableWwwAuthenticateModeValues() []DisableWwwAuthenticateMode { + return []DisableWwwAuthenticateMode{ + DisableWwwAuthenticateModeFalse, + DisableWwwAuthenticateModeTrue, + } +} + +// ToPtr returns a *DisableWwwAuthenticateMode pointing to the current value. +func (c DisableWwwAuthenticateMode) ToPtr() *DisableWwwAuthenticateMode { + return &c +} + +// EasyAuthState - Enabled if the Authentication / Authorization feature is enabled for the current app; otherwise, Disabled. +type EasyAuthState string + +const ( + EasyAuthStateDisabled EasyAuthState = "Disabled" + EasyAuthStateEnabled EasyAuthState = "Enabled" +) + +// PossibleEasyAuthStateValues returns the possible values for the EasyAuthState const type. +func PossibleEasyAuthStateValues() []EasyAuthState { + return []EasyAuthState{ + EasyAuthStateDisabled, + EasyAuthStateEnabled, + } +} + +// ToPtr returns a *EasyAuthState pointing to the current value. +func (c EasyAuthState) ToPtr() *EasyAuthState { + return &c +} + +// 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, + } +} + +// ToPtr returns a *EnvironmentProvisioningState pointing to the current value. +func (c EnvironmentProvisioningState) ToPtr() *EnvironmentProvisioningState { + return &c +} + +// IdentityProviderState - Indicate whether identity provider is enabled or disabled. +type IdentityProviderState string + +const ( + IdentityProviderStateDisabled IdentityProviderState = "Disabled" + IdentityProviderStateEnabled IdentityProviderState = "Enabled" +) + +// PossibleIdentityProviderStateValues returns the possible values for the IdentityProviderState const type. +func PossibleIdentityProviderStateValues() []IdentityProviderState { + return []IdentityProviderState{ + IdentityProviderStateDisabled, + IdentityProviderStateEnabled, + } +} + +// ToPtr returns a *IdentityProviderState pointing to the current value. +func (c IdentityProviderState) ToPtr() *IdentityProviderState { + return &c +} + +// 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, + } +} + +// ToPtr returns a *IngressTransportMethod pointing to the current value. +func (c IngressTransportMethod) ToPtr() *IngressTransportMethod { + return &c +} + +// 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, + } +} + +// ToPtr returns a *ManagedServiceIdentityType pointing to the current value. +func (c ManagedServiceIdentityType) ToPtr() *ManagedServiceIdentityType { + return &c +} + +// PreserveURLFragmentsForLoginsMode - True if the fragments from the request are preserved after the login request is made; +// otherwise, False. +type PreserveURLFragmentsForLoginsMode string + +const ( + PreserveURLFragmentsForLoginsModeFalse PreserveURLFragmentsForLoginsMode = "False" + PreserveURLFragmentsForLoginsModeTrue PreserveURLFragmentsForLoginsMode = "True" +) + +// PossiblePreserveURLFragmentsForLoginsModeValues returns the possible values for the PreserveURLFragmentsForLoginsMode const type. +func PossiblePreserveURLFragmentsForLoginsModeValues() []PreserveURLFragmentsForLoginsMode { + return []PreserveURLFragmentsForLoginsMode{ + PreserveURLFragmentsForLoginsModeFalse, + PreserveURLFragmentsForLoginsModeTrue, + } +} + +// ToPtr returns a *PreserveURLFragmentsForLoginsMode pointing to the current value. +func (c PreserveURLFragmentsForLoginsMode) ToPtr() *PreserveURLFragmentsForLoginsMode { + return &c +} + +// RequireHTTPSMode - false if the authentication/authorization responses not having the HTTPS scheme are permissible; otherwise, +// true. +type RequireHTTPSMode string + +const ( + RequireHTTPSModeFalse RequireHTTPSMode = "False" + RequireHTTPSModeTrue RequireHTTPSMode = "True" +) + +// PossibleRequireHTTPSModeValues returns the possible values for the RequireHTTPSMode const type. +func PossibleRequireHTTPSModeValues() []RequireHTTPSMode { + return []RequireHTTPSMode{ + RequireHTTPSModeFalse, + RequireHTTPSModeTrue, + } +} + +// ToPtr returns a *RequireHTTPSMode pointing to the current value. +func (c RequireHTTPSMode) ToPtr() *RequireHTTPSMode { + return &c +} + +// 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, + } +} + +// ToPtr returns a *RevisionHealthState pointing to the current value. +func (c RevisionHealthState) ToPtr() *RevisionHealthState { + return &c +} + +// 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, + } +} + +// ToPtr returns a *RevisionProvisioningState pointing to the current value. +func (c RevisionProvisioningState) ToPtr() *RevisionProvisioningState { + return &c +} + +// 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, + } +} + +// ToPtr returns a *SourceControlOperationState pointing to the current value. +func (c SourceControlOperationState) ToPtr() *SourceControlOperationState { + return &c +} + +// 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, + } +} + +// ToPtr returns a *StorageType pointing to the current value. +func (c StorageType) ToPtr() *StorageType { + return &c +} + +// 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, + } +} + +// ToPtr returns a *Type pointing to the current value. +func (c Type) ToPtr() *Type { + return &c +} + +// UnauthenticatedClientAction - The action to take when an unauthenticated client attempts to access the app. +type UnauthenticatedClientAction string + +const ( + UnauthenticatedClientActionAllowAnonymous UnauthenticatedClientAction = "AllowAnonymous" + UnauthenticatedClientActionRedirectToLoginPage UnauthenticatedClientAction = "RedirectToLoginPage" + UnauthenticatedClientActionReturn401 UnauthenticatedClientAction = "Return401" + UnauthenticatedClientActionReturn403 UnauthenticatedClientAction = "Return403" +) + +// PossibleUnauthenticatedClientActionValues returns the possible values for the UnauthenticatedClientAction const type. +func PossibleUnauthenticatedClientActionValues() []UnauthenticatedClientAction { + return []UnauthenticatedClientAction{ + UnauthenticatedClientActionAllowAnonymous, + UnauthenticatedClientActionRedirectToLoginPage, + UnauthenticatedClientActionReturn401, + UnauthenticatedClientActionReturn403, + } +} + +// ToPtr returns a *UnauthenticatedClientAction pointing to the current value. +func (c UnauthenticatedClientAction) ToPtr() *UnauthenticatedClientAction { + return &c +} 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..63ae61494b58 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerapps_client.go @@ -0,0 +1,502 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ContainerAppsClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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) (ContainerAppsClientCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, name, containerAppEnvelope, options) + if err != nil { + return ContainerAppsClientCreateOrUpdatePollerResponse{}, err + } + result := ContainerAppsClientCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ContainerAppsClient.CreateOrUpdate", "", resp, client.pl) + if err != nil { + return ContainerAppsClientCreateOrUpdatePollerResponse{}, err + } + result.Poller = &ContainerAppsClientCreateOrUpdatePoller{ + pt: pt, + } + return result, 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-01-01-preview") + 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) (ContainerAppsClientDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, name, options) + if err != nil { + return ContainerAppsClientDeletePollerResponse{}, err + } + result := ContainerAppsClientDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ContainerAppsClient.Delete", "", resp, client.pl) + if err != nil { + return ContainerAppsClientDeletePollerResponse{}, err + } + result.Poller = &ContainerAppsClientDeletePoller{ + pt: pt, + } + return result, 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-01-01-preview") + 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-01-01-preview") + 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{RawResponse: resp} + 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) *ContainerAppsClientListByResourceGroupPager { + return &ContainerAppsClientListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp ContainerAppsClientListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ContainerAppCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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) *ContainerAppsClientListBySubscriptionPager { + return &ContainerAppsClientListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp ContainerAppsClientListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ContainerAppCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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-01-01-preview") + 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{RawResponse: resp} + 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-01-01-preview") + 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{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SecretsCollection); err != nil { + return ContainerAppsClientListSecretsResponse{}, err + } + return result, nil +} + +// Update - Patches a Container App. 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. +// name - Name of the Container App. +// containerAppEnvelope - Properties of a container app that need to be updated +// options - ContainerAppsClientUpdateOptions contains the optional parameters for the ContainerAppsClient.Update method. +func (client *ContainerAppsClient) Update(ctx context.Context, resourceGroupName string, name string, containerAppEnvelope ContainerAppPatch, options *ContainerAppsClientUpdateOptions) (ContainerAppsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, name, containerAppEnvelope, options) + if err != nil { + return ContainerAppsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerAppsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ContainerAppsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, containerAppEnvelope ContainerAppPatch, options *ContainerAppsClientUpdateOptions) (*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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, containerAppEnvelope) +} + +// updateHandleResponse handles the Update response. +func (client *ContainerAppsClient) updateHandleResponse(resp *http.Response) (ContainerAppsClientUpdateResponse, error) { + result := ContainerAppsClientUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerApp); err != nil { + return ContainerAppsClientUpdateResponse{}, err + } + return result, nil +} 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..f9a7a67fb0b0 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerappsauthconfigs_client.go @@ -0,0 +1,278 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ContainerAppsAuthConfigsClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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{RawResponse: resp}, 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-01-01-preview") + 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-01-01-preview") + 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{RawResponse: resp} + 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) *ContainerAppsAuthConfigsClientListByContainerAppPager { + return &ContainerAppsAuthConfigsClientListByContainerAppPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByContainerAppCreateRequest(ctx, resourceGroupName, containerAppName, options) + }, + advancer: func(ctx context.Context, resp ContainerAppsAuthConfigsClientListByContainerAppResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AuthConfigCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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..f6de29a234a7 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerappsrevisionreplicas_client.go @@ -0,0 +1,177 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ContainerAppsRevisionReplicasClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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-01-01-preview") + 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{RawResponse: resp} + 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..78a32ccbf76e --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerappsrevisions_client.go @@ -0,0 +1,320 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ContainerAppsRevisionsClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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{RawResponse: resp}, 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-01-01-preview") + 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{RawResponse: resp}, 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-01-01-preview") + 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-01-01-preview") + 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{RawResponse: resp} + 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) *ContainerAppsRevisionsClientListRevisionsPager { + return &ContainerAppsRevisionsClientListRevisionsPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listRevisionsCreateRequest(ctx, resourceGroupName, containerAppName, options) + }, + advancer: func(ctx context.Context, resp ContainerAppsRevisionsClientListRevisionsResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RevisionCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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{RawResponse: resp}, 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-01-01-preview") + 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..a936a6941dfa --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_containerappssourcecontrols_client.go @@ -0,0 +1,309 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ContainerAppsSourceControlsClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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) (ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, containerAppName, name, sourceControlEnvelope, options) + if err != nil { + return ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse{}, err + } + result := ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ContainerAppsSourceControlsClient.CreateOrUpdate", "", resp, client.pl) + if err != nil { + return ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse{}, err + } + result.Poller = &ContainerAppsSourceControlsClientCreateOrUpdatePoller{ + pt: pt, + } + return result, 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-01-01-preview") + 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) (ContainerAppsSourceControlsClientDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, containerAppName, name, options) + if err != nil { + return ContainerAppsSourceControlsClientDeletePollerResponse{}, err + } + result := ContainerAppsSourceControlsClientDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ContainerAppsSourceControlsClient.Delete", "", resp, client.pl) + if err != nil { + return ContainerAppsSourceControlsClientDeletePollerResponse{}, err + } + result.Poller = &ContainerAppsSourceControlsClientDeletePoller{ + pt: pt, + } + return result, 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-01-01-preview") + 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-01-01-preview") + 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{RawResponse: resp} + 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) *ContainerAppsSourceControlsClientListByContainerAppPager { + return &ContainerAppsSourceControlsClientListByContainerAppPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByContainerAppCreateRequest(ctx, resourceGroupName, containerAppName, options) + }, + advancer: func(ctx context.Context, resp ContainerAppsSourceControlsClientListByContainerAppResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SourceControlCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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..987b09de438e --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_daprcomponents_client.go @@ -0,0 +1,275 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &DaprComponentsClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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{RawResponse: resp}, 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-01-01-preview") + 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-01-01-preview") + 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{RawResponse: resp} + 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) *DaprComponentsClientListPager { + return &DaprComponentsClientListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, environmentName, options) + }, + advancer: func(ctx context.Context, resp DaprComponentsClientListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DaprComponentsCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponentsCollection); err != nil { + return DaprComponentsClientListResponse{}, 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..8d0623605de0 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_managedenvironments_client.go @@ -0,0 +1,388 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ManagedEnvironmentsClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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) (ManagedEnvironmentsClientCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, name, environmentEnvelope, options) + if err != nil { + return ManagedEnvironmentsClientCreateOrUpdatePollerResponse{}, err + } + result := ManagedEnvironmentsClientCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ManagedEnvironmentsClient.CreateOrUpdate", "", resp, client.pl) + if err != nil { + return ManagedEnvironmentsClientCreateOrUpdatePollerResponse{}, err + } + result.Poller = &ManagedEnvironmentsClientCreateOrUpdatePoller{ + pt: pt, + } + return result, 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-01-01-preview") + 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) (ManagedEnvironmentsClientDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, name, options) + if err != nil { + return ManagedEnvironmentsClientDeletePollerResponse{}, err + } + result := ManagedEnvironmentsClientDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ManagedEnvironmentsClient.Delete", "", resp, client.pl) + if err != nil { + return ManagedEnvironmentsClientDeletePollerResponse{}, err + } + result.Poller = &ManagedEnvironmentsClientDeletePoller{ + pt: pt, + } + return result, 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-01-01-preview") + 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-01-01-preview") + 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{RawResponse: resp} + 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) *ManagedEnvironmentsClientListByResourceGroupPager { + return &ManagedEnvironmentsClientListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp ManagedEnvironmentsClientListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ManagedEnvironmentsCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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) *ManagedEnvironmentsClientListBySubscriptionPager { + return &ManagedEnvironmentsClientListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp ManagedEnvironmentsClientListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ManagedEnvironmentsCollection.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironmentsCollection); err != nil { + return ManagedEnvironmentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Patches a Managed Environment. Only patching of tags is supported currently +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// name - Name of the Environment. +// environmentEnvelope - Configuration details of the Environment. +// options - ManagedEnvironmentsClientUpdateOptions contains the optional parameters for the ManagedEnvironmentsClient.Update +// method. +func (client *ManagedEnvironmentsClient) Update(ctx context.Context, resourceGroupName string, name string, environmentEnvelope ManagedEnvironmentPatch, options *ManagedEnvironmentsClientUpdateOptions) (ManagedEnvironmentsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, name, environmentEnvelope, options) + if err != nil { + return ManagedEnvironmentsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedEnvironmentsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ManagedEnvironmentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, environmentEnvelope ManagedEnvironmentPatch, options *ManagedEnvironmentsClientUpdateOptions) (*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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, environmentEnvelope) +} + +// updateHandleResponse handles the Update response. +func (client *ManagedEnvironmentsClient) updateHandleResponse(resp *http.Response) (ManagedEnvironmentsClientUpdateResponse, error) { + result := ManagedEnvironmentsClientUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironment); err != nil { + return ManagedEnvironmentsClientUpdateResponse{}, err + } + return result, nil +} 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..3c4960f83f6b --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_managedenvironmentsstorages_client.go @@ -0,0 +1,281 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ManagedEnvironmentsStoragesClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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-01-01-preview") + 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{RawResponse: resp} + 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{RawResponse: resp}, 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-01-01-preview") + 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-01-01-preview") + 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{RawResponse: resp} + 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-01-01-preview") + 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{RawResponse: resp} + 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..a8ed024c5504 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_models.go @@ -0,0 +1,2395 @@ +//go:build go1.16 +// +build go1.16 + +// 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" + "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"` +} + +// 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) +} + +// Apple - The configuration settings of the Apple provider. +type Apple struct { + // The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` + + // The configuration settings of the Apple registration. + Registration *AppleRegistration `json:"registration,omitempty"` + + // Disabled if the Apple provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,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 secret ref name that contains the client secret. + ClientSecretRefName *string `json:"clientSecretRefName,omitempty"` +} + +// AuthConfig - Configuration settings for the Azure ContainerApp Authentication / Authorization feature. +type AuthConfig struct { + // Easy Auth configuration 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"` +} + +// 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) +} + +// AuthConfigProperties - Easy Auth configuration resource specific properties +type AuthConfigProperties struct { + // The configuration settings that determines the validation flow of users using ContainerApp Authentication/Authorization. + GlobalValidation *GlobalValidation `json:"globalValidation,omitempty"` + + // The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp + // Authentication/Authorization. + HTTPSettings *HTTPSettings `json:"httpSettings,omitempty"` + + // The configuration settings of each of the identity providers used to configure ContainerApp Authentication/Authorization. + IdentityProviders *IdentityProviders `json:"identityProviders,omitempty"` + + // The configuration settings of the login flow of users using ContainerApp Authentication/Authorization. + Login *Login `json:"login,omitempty"` + + // Enabled if the Authentication / Authorization feature is enabled for the current app; otherwise, Disabled. + State *EasyAuthState `json:"state,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"` +} + +// 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) +} + +// AzureActiveDirectory - The configuration settings of the Azure Active directory provider. +type AzureActiveDirectory struct { + // 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"` + + // Disabled if the Azure Active Directory provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,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 *DisableWwwAuthenticateMode `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"` +} + +// 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) +} + +// 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 secret ref name that contains the client secret of the relying party application. + ClientSecretRefName *string `json:"clientSecretRefName,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"` +} + +// 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) + return json.Marshal(objectMap) +} + +// 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"` +} + +// AzureStaticWebApp - The configuration settings of the Azure Static Web Apps provider. +type AzureStaticWebApp struct { + // The configuration settings of the Azure Static Web Apps registration. + Registration *AzureStaticWebAppRegistration `json:"registration,omitempty"` + + // Disabled if the Azure Static Web Apps provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,omitempty"` +} + +// AzureStaticWebAppRegistration - The configuration settings of the registration for the Azure Static Web Apps provider +type AzureStaticWebAppRegistration 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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; 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"` +} + +// 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, "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 "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 +} + +// 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 +} + +// 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 secret ref name that contains the client secret. + ClientSecretRefName *string `json:"clientSecretRefName,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. If no value if provided, this is the defaultSingle: Only one revision + // can be active at a time. Revision weights can not be used in this mode + ActiveRevisionsMode *ActiveRevisionsMode `json:"activeRevisionsMode,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"` +} + +// 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, "ingress", c.Ingress) + populate(objectMap, "registries", c.Registries) + populate(objectMap, "secrets", c.Secrets) + return json.Marshal(objectMap) +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// ContainerAppPatch - Container App Patch. +type ContainerAppPatch struct { + // Application-specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerAppPatch. +func (c ContainerAppPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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 { + // placeholder for future optional parameters +} + +// ContainerAppsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsClient.BeginDelete method. +type ContainerAppsClientBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// ContainerAppsClientUpdateOptions contains the optional parameters for the ContainerAppsClient.Update method. +type ContainerAppsClientUpdateOptions 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 { + // placeholder for future optional parameters +} + +// 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 { + // placeholder for future optional parameters +} + +// ContainerAppsSourceControlsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsSourceControlsClient.BeginDelete +// method. +type ContainerAppsSourceControlsClientBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// 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"` +} + +// CustomDomain - Custom Domain of a Container App +type CustomDomain struct { + // Custom Domain binding type. + BindingType *BindingType `json:"bindingType,omitempty"` + + // Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. + CertificateID *string `json:"certificateId,omitempty"` + + // Hostname. + Name *string `json:"name,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"` +} + +// 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) +} + +// CustomOpenIDConnectProvider - The configuration settings of the custom Open ID Connect provider. +type CustomOpenIDConnectProvider struct { + // 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"` + + // Disabled if the custom Open ID Connect provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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 +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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"` +} + +// 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) +} + +// 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 { + // 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"` + + // Disabled if the Facebook provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,omitempty"` +} + +// GitHub - The configuration settings of the GitHub provider. +type GitHub struct { + // 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"` + + // Disabled if the GitHub provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,omitempty"` +} + +// GithubActionConfiguration - Configuration properties that define the mutable settings of a Container App SourceControl +type GithubActionConfiguration struct { + // AzureCredentials configurations. + AzureCredentials *AzureCredentials `json:"azureCredentials,omitempty"` + + // Docker file path + DockerfilePath *string `json:"dockerfilePath,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 Authentication/Authorization. +type GlobalValidation struct { + // 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 *UnauthenticatedClientAction `json:"unauthenticatedClientAction,omitempty"` +} + +// Google - The configuration settings of the Google provider. +type Google struct { + // 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"` + + // Disabled if the Google provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,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"` +} + +// 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) +} + +// HTTPSettings - The configuration settings of the HTTP requests for authentication and authorization requests made against +// ContainerApp Authentication/Authorization. +type HTTPSettings struct { + // false if the authentication/authorization responses not having the HTTPS scheme are permissible; otherwise, true. + RequireHTTPS *RequireHTTPSMode `json:"requireHttps,omitempty"` + + // The configuration settings of the paths HTTP requests. + Route *HTTPSettingsRoute `json:"route,omitempty"` +} + +// HTTPSettingsRoute - The configuration settings of the paths HTTP requests. +type HTTPSettingsRoute 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 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. + AzureStaticWebApp *AzureStaticWebApp `json:"azureStaticWebApp,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 legacy Microsoft Account provider. + LegacyMicrosoftAccount *LegacyMicrosoftAccount `json:"legacyMicrosoftAccount,omitempty"` + + // The configuration settings of the Twitter provider. + Twitter *Twitter `json:"twitter,omitempty"` +} + +// 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, "azureStaticWebApp", i.AzureStaticWebApp) + populate(objectMap, "customOpenIdConnectProviders", i.CustomOpenIDConnectProviders) + populate(objectMap, "facebook", i.Facebook) + populate(objectMap, "gitHub", i.GitHub) + populate(objectMap, "google", i.Google) + populate(objectMap, "legacyMicrosoftAccount", i.LegacyMicrosoftAccount) + populate(objectMap, "twitter", i.Twitter) + return json.Marshal(objectMap) +} + +// 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"` +} + +// 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) +} + +// LegacyMicrosoftAccount - The configuration settings of the legacy Microsoft Account provider. +type LegacyMicrosoftAccount struct { + // The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` + + // The configuration settings of the app registration for the legacy Microsoft Account provider. + Registration *ClientRegistration `json:"registration,omitempty"` + + // Disabled if the legacy Microsoft Account provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,omitempty"` + + // The configuration settings of the legacy Microsoft Account provider token validation flow. + Validation *AllowedAudiencesValidation `json:"validation,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 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"` + + // True if the fragments from the request are preserved after the login request is made; otherwise, False. + PreserveURLFragmentsForLogins *PreserveURLFragmentsForLoginsMode `json:"preserveUrlFragmentsForLogins,omitempty"` + + // The route that specify the endpoint used for login and logout requests. + Route *LoginRoute `json:"route,omitempty"` +} + +// 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, "preserveUrlFragmentsForLogins", l.PreserveURLFragmentsForLogins) + populate(objectMap, "route", l.Route) + return json.Marshal(objectMap) +} + +// LoginRoute - The route that specify the endpoint used for login and logout requests. +type LoginRoute 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// ManagedEnvironmentPatch - An environment for hosting container apps +type ManagedEnvironmentPatch struct { + // Application-specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedEnvironmentPatch. +func (m ManagedEnvironmentPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// 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"` + + // 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"` + + // 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"` +} + +// 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) +} + +// ManagedEnvironmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginCreateOrUpdate +// method. +type ManagedEnvironmentsClientBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginDelete +// method. +type ManagedEnvironmentsClientBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// ManagedEnvironmentsClientUpdateOptions contains the optional parameters for the ManagedEnvironmentsClient.Update method. +type ManagedEnvironmentsClientUpdateOptions 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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. + ClientSecretRefName *string `json:"clientSecretRefName,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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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 secret ref name that contains the app secret. + AppSecretRefName *string `json:"appSecretRefName,omitempty"` +} + +// RegistryCredentials - Container App Private Registry +type RegistryCredentials struct { + // 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"` +} + +// 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) +} + +// 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"` +} + +// 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 +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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 +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// 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 +} + +// 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"` + + // Dapr configuration for the Container App. + Dapr *Dapr `json:"dapr,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"` +} + +// 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, "dapr", t.Dapr) + populate(objectMap, "revisionSuffix", t.RevisionSuffix) + populate(objectMap, "scale", t.Scale) + populate(objectMap, "volumes", t.Volumes) + return json.Marshal(objectMap) +} + +// 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"` +} + +// 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) +} + +// TrafficWeight - Traffic weight assigned to a revision +type TrafficWeight struct { + // 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 { + // The configuration settings of the app registration for the Twitter provider. + Registration *TwitterRegistration `json:"registration,omitempty"` + + // Disabled if the Twitter provider should not be enabled despite the set registration; otherwise, Enabled. + State *IdentityProviderState `json:"state,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 secret ref name that contains the OAuth 1.0a consumer secret of the Twitter application used for sign-in. + ConsumerSecretRefName *string `json:"consumerSecretRefName,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"` +} + +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_operations_client.go b/sdk/resourcemanager/app/armapp/zz_generated_operations_client.go new file mode 100644 index 000000000000..cc24bc272ed5 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_operations_client.go @@ -0,0 +1,82 @@ +//go:build go1.16 +// +build go1.16 + +// 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/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 { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &OperationsClient{ + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// 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) *OperationsClientListPager { + return &OperationsClientListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AvailableOperations.NextLink) + }, + } +} + +// 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-01-01-preview") + 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{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableOperations); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/app/armapp/zz_generated_pagers.go b/sdk/resourcemanager/app/armapp/zz_generated_pagers.go new file mode 100644 index 000000000000..da1ffcc25fd4 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_pagers.go @@ -0,0 +1,557 @@ +//go:build go1.16 +// +build go1.16 + +// 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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" +) + +// CertificatesClientListPager provides operations for iterating over paged responses. +type CertificatesClientListPager struct { + client *CertificatesClient + current CertificatesClientListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CertificatesClientListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *CertificatesClientListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CertificatesClientListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.CertificateCollection.NextLink == nil || len(*p.current.CertificateCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current CertificatesClientListResponse page. +func (p *CertificatesClientListPager) PageResponse() CertificatesClientListResponse { + return p.current +} + +// ContainerAppsAuthConfigsClientListByContainerAppPager provides operations for iterating over paged responses. +type ContainerAppsAuthConfigsClientListByContainerAppPager struct { + client *ContainerAppsAuthConfigsClient + current ContainerAppsAuthConfigsClientListByContainerAppResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ContainerAppsAuthConfigsClientListByContainerAppResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ContainerAppsAuthConfigsClientListByContainerAppPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ContainerAppsAuthConfigsClientListByContainerAppPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AuthConfigCollection.NextLink == nil || len(*p.current.AuthConfigCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByContainerAppHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ContainerAppsAuthConfigsClientListByContainerAppResponse page. +func (p *ContainerAppsAuthConfigsClientListByContainerAppPager) PageResponse() ContainerAppsAuthConfigsClientListByContainerAppResponse { + return p.current +} + +// ContainerAppsClientListByResourceGroupPager provides operations for iterating over paged responses. +type ContainerAppsClientListByResourceGroupPager struct { + client *ContainerAppsClient + current ContainerAppsClientListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ContainerAppsClientListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ContainerAppsClientListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ContainerAppsClientListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ContainerAppCollection.NextLink == nil || len(*p.current.ContainerAppCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ContainerAppsClientListByResourceGroupResponse page. +func (p *ContainerAppsClientListByResourceGroupPager) PageResponse() ContainerAppsClientListByResourceGroupResponse { + return p.current +} + +// ContainerAppsClientListBySubscriptionPager provides operations for iterating over paged responses. +type ContainerAppsClientListBySubscriptionPager struct { + client *ContainerAppsClient + current ContainerAppsClientListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ContainerAppsClientListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ContainerAppsClientListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ContainerAppsClientListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ContainerAppCollection.NextLink == nil || len(*p.current.ContainerAppCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ContainerAppsClientListBySubscriptionResponse page. +func (p *ContainerAppsClientListBySubscriptionPager) PageResponse() ContainerAppsClientListBySubscriptionResponse { + return p.current +} + +// ContainerAppsRevisionsClientListRevisionsPager provides operations for iterating over paged responses. +type ContainerAppsRevisionsClientListRevisionsPager struct { + client *ContainerAppsRevisionsClient + current ContainerAppsRevisionsClientListRevisionsResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ContainerAppsRevisionsClientListRevisionsResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ContainerAppsRevisionsClientListRevisionsPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ContainerAppsRevisionsClientListRevisionsPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.RevisionCollection.NextLink == nil || len(*p.current.RevisionCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listRevisionsHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ContainerAppsRevisionsClientListRevisionsResponse page. +func (p *ContainerAppsRevisionsClientListRevisionsPager) PageResponse() ContainerAppsRevisionsClientListRevisionsResponse { + return p.current +} + +// ContainerAppsSourceControlsClientListByContainerAppPager provides operations for iterating over paged responses. +type ContainerAppsSourceControlsClientListByContainerAppPager struct { + client *ContainerAppsSourceControlsClient + current ContainerAppsSourceControlsClientListByContainerAppResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ContainerAppsSourceControlsClientListByContainerAppResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ContainerAppsSourceControlsClientListByContainerAppPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ContainerAppsSourceControlsClientListByContainerAppPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SourceControlCollection.NextLink == nil || len(*p.current.SourceControlCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByContainerAppHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ContainerAppsSourceControlsClientListByContainerAppResponse page. +func (p *ContainerAppsSourceControlsClientListByContainerAppPager) PageResponse() ContainerAppsSourceControlsClientListByContainerAppResponse { + return p.current +} + +// DaprComponentsClientListPager provides operations for iterating over paged responses. +type DaprComponentsClientListPager struct { + client *DaprComponentsClient + current DaprComponentsClientListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DaprComponentsClientListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *DaprComponentsClientListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DaprComponentsClientListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.DaprComponentsCollection.NextLink == nil || len(*p.current.DaprComponentsCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current DaprComponentsClientListResponse page. +func (p *DaprComponentsClientListPager) PageResponse() DaprComponentsClientListResponse { + return p.current +} + +// ManagedEnvironmentsClientListByResourceGroupPager provides operations for iterating over paged responses. +type ManagedEnvironmentsClientListByResourceGroupPager struct { + client *ManagedEnvironmentsClient + current ManagedEnvironmentsClientListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ManagedEnvironmentsClientListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ManagedEnvironmentsClientListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ManagedEnvironmentsClientListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ManagedEnvironmentsCollection.NextLink == nil || len(*p.current.ManagedEnvironmentsCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ManagedEnvironmentsClientListByResourceGroupResponse page. +func (p *ManagedEnvironmentsClientListByResourceGroupPager) PageResponse() ManagedEnvironmentsClientListByResourceGroupResponse { + return p.current +} + +// ManagedEnvironmentsClientListBySubscriptionPager provides operations for iterating over paged responses. +type ManagedEnvironmentsClientListBySubscriptionPager struct { + client *ManagedEnvironmentsClient + current ManagedEnvironmentsClientListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ManagedEnvironmentsClientListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ManagedEnvironmentsClientListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ManagedEnvironmentsClientListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ManagedEnvironmentsCollection.NextLink == nil || len(*p.current.ManagedEnvironmentsCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ManagedEnvironmentsClientListBySubscriptionResponse page. +func (p *ManagedEnvironmentsClientListBySubscriptionPager) PageResponse() ManagedEnvironmentsClientListBySubscriptionResponse { + return p.current +} + +// OperationsClientListPager provides operations for iterating over paged responses. +type OperationsClientListPager struct { + client *OperationsClient + current OperationsClientListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OperationsClientListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OperationsClientListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AvailableOperations.NextLink == nil || len(*p.current.AvailableOperations.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OperationsClientListResponse page. +func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { + return p.current +} diff --git a/sdk/resourcemanager/app/armapp/zz_generated_pollers.go b/sdk/resourcemanager/app/armapp/zz_generated_pollers.go new file mode 100644 index 000000000000..7444fec1c767 --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_pollers.go @@ -0,0 +1,273 @@ +//go:build go1.16 +// +build go1.16 + +// 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" + "net/http" +) + +// ContainerAppsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ContainerAppsClientCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ContainerAppsClientCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ContainerAppsClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ContainerAppsClientCreateOrUpdateResponse will be returned. +func (p *ContainerAppsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ContainerAppsClientCreateOrUpdateResponse, error) { + respType := ContainerAppsClientCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.ContainerApp) + if err != nil { + return ContainerAppsClientCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ContainerAppsClientCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ContainerAppsClientDeletePoller provides polling facilities until the operation reaches a terminal state. +type ContainerAppsClientDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ContainerAppsClientDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ContainerAppsClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ContainerAppsClientDeleteResponse will be returned. +func (p *ContainerAppsClientDeletePoller) FinalResponse(ctx context.Context) (ContainerAppsClientDeleteResponse, error) { + respType := ContainerAppsClientDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ContainerAppsClientDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ContainerAppsClientDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ContainerAppsSourceControlsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ContainerAppsSourceControlsClientCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ContainerAppsSourceControlsClientCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ContainerAppsSourceControlsClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ContainerAppsSourceControlsClientCreateOrUpdateResponse will be returned. +func (p *ContainerAppsSourceControlsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ContainerAppsSourceControlsClientCreateOrUpdateResponse, error) { + respType := ContainerAppsSourceControlsClientCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SourceControl) + if err != nil { + return ContainerAppsSourceControlsClientCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ContainerAppsSourceControlsClientCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ContainerAppsSourceControlsClientDeletePoller provides polling facilities until the operation reaches a terminal state. +type ContainerAppsSourceControlsClientDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ContainerAppsSourceControlsClientDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ContainerAppsSourceControlsClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ContainerAppsSourceControlsClientDeleteResponse will be returned. +func (p *ContainerAppsSourceControlsClientDeletePoller) FinalResponse(ctx context.Context) (ContainerAppsSourceControlsClientDeleteResponse, error) { + respType := ContainerAppsSourceControlsClientDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ContainerAppsSourceControlsClientDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ContainerAppsSourceControlsClientDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ManagedEnvironmentsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ManagedEnvironmentsClientCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ManagedEnvironmentsClientCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ManagedEnvironmentsClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ManagedEnvironmentsClientCreateOrUpdateResponse will be returned. +func (p *ManagedEnvironmentsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ManagedEnvironmentsClientCreateOrUpdateResponse, error) { + respType := ManagedEnvironmentsClientCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.ManagedEnvironment) + if err != nil { + return ManagedEnvironmentsClientCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ManagedEnvironmentsClientCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ManagedEnvironmentsClientDeletePoller provides polling facilities until the operation reaches a terminal state. +type ManagedEnvironmentsClientDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ManagedEnvironmentsClientDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ManagedEnvironmentsClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ManagedEnvironmentsClientDeleteResponse will be returned. +func (p *ManagedEnvironmentsClientDeletePoller) FinalResponse(ctx context.Context) (ManagedEnvironmentsClientDeleteResponse, error) { + respType := ManagedEnvironmentsClientDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ManagedEnvironmentsClientDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ManagedEnvironmentsClientDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} 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..61fc5dab5e5b --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_response_types.go @@ -0,0 +1,712 @@ +//go:build go1.16 +// +build go1.16 + +// 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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// CertificatesClientCreateOrUpdateResponse contains the response from method CertificatesClient.CreateOrUpdate. +type CertificatesClientCreateOrUpdateResponse struct { + CertificatesClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CertificatesClientCreateOrUpdateResult contains the result from method CertificatesClient.CreateOrUpdate. +type CertificatesClientCreateOrUpdateResult struct { + Certificate +} + +// CertificatesClientDeleteResponse contains the response from method CertificatesClient.Delete. +type CertificatesClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CertificatesClientGetResponse contains the response from method CertificatesClient.Get. +type CertificatesClientGetResponse struct { + CertificatesClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CertificatesClientGetResult contains the result from method CertificatesClient.Get. +type CertificatesClientGetResult struct { + Certificate +} + +// CertificatesClientListResponse contains the response from method CertificatesClient.List. +type CertificatesClientListResponse struct { + CertificatesClientListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CertificatesClientListResult contains the result from method CertificatesClient.List. +type CertificatesClientListResult struct { + CertificateCollection +} + +// CertificatesClientUpdateResponse contains the response from method CertificatesClient.Update. +type CertificatesClientUpdateResponse struct { + CertificatesClientUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CertificatesClientUpdateResult contains the result from method CertificatesClient.Update. +type CertificatesClientUpdateResult struct { + Certificate +} + +// ContainerAppsAuthConfigsClientCreateOrUpdateResponse contains the response from method ContainerAppsAuthConfigsClient.CreateOrUpdate. +type ContainerAppsAuthConfigsClientCreateOrUpdateResponse struct { + ContainerAppsAuthConfigsClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsAuthConfigsClientCreateOrUpdateResult contains the result from method ContainerAppsAuthConfigsClient.CreateOrUpdate. +type ContainerAppsAuthConfigsClientCreateOrUpdateResult struct { + AuthConfig +} + +// ContainerAppsAuthConfigsClientDeleteResponse contains the response from method ContainerAppsAuthConfigsClient.Delete. +type ContainerAppsAuthConfigsClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsAuthConfigsClientGetResponse contains the response from method ContainerAppsAuthConfigsClient.Get. +type ContainerAppsAuthConfigsClientGetResponse struct { + ContainerAppsAuthConfigsClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsAuthConfigsClientGetResult contains the result from method ContainerAppsAuthConfigsClient.Get. +type ContainerAppsAuthConfigsClientGetResult struct { + AuthConfig +} + +// ContainerAppsAuthConfigsClientListByContainerAppResponse contains the response from method ContainerAppsAuthConfigsClient.ListByContainerApp. +type ContainerAppsAuthConfigsClientListByContainerAppResponse struct { + ContainerAppsAuthConfigsClientListByContainerAppResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsAuthConfigsClientListByContainerAppResult contains the result from method ContainerAppsAuthConfigsClient.ListByContainerApp. +type ContainerAppsAuthConfigsClientListByContainerAppResult struct { + AuthConfigCollection +} + +// ContainerAppsClientCreateOrUpdatePollerResponse contains the response from method ContainerAppsClient.CreateOrUpdate. +type ContainerAppsClientCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ContainerAppsClientCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ContainerAppsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ContainerAppsClientCreateOrUpdateResponse, error) { + respType := ContainerAppsClientCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ContainerApp) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ContainerAppsClientCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *ContainerAppsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ContainerAppsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ContainerAppsClient.CreateOrUpdate", token, client.pl) + if err != nil { + return err + } + poller := &ContainerAppsClientCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ContainerAppsClientCreateOrUpdateResponse contains the response from method ContainerAppsClient.CreateOrUpdate. +type ContainerAppsClientCreateOrUpdateResponse struct { + ContainerAppsClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsClientCreateOrUpdateResult contains the result from method ContainerAppsClient.CreateOrUpdate. +type ContainerAppsClientCreateOrUpdateResult struct { + ContainerApp +} + +// ContainerAppsClientDeletePollerResponse contains the response from method ContainerAppsClient.Delete. +type ContainerAppsClientDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *ContainerAppsClientDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ContainerAppsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ContainerAppsClientDeleteResponse, error) { + respType := ContainerAppsClientDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ContainerAppsClientDeletePollerResponse from the provided client and resume token. +func (l *ContainerAppsClientDeletePollerResponse) Resume(ctx context.Context, client *ContainerAppsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ContainerAppsClient.Delete", token, client.pl) + if err != nil { + return err + } + poller := &ContainerAppsClientDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ContainerAppsClientDeleteResponse contains the response from method ContainerAppsClient.Delete. +type ContainerAppsClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsClientGetResponse contains the response from method ContainerAppsClient.Get. +type ContainerAppsClientGetResponse struct { + ContainerAppsClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsClientGetResult contains the result from method ContainerAppsClient.Get. +type ContainerAppsClientGetResult struct { + ContainerApp +} + +// ContainerAppsClientListByResourceGroupResponse contains the response from method ContainerAppsClient.ListByResourceGroup. +type ContainerAppsClientListByResourceGroupResponse struct { + ContainerAppsClientListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsClientListByResourceGroupResult contains the result from method ContainerAppsClient.ListByResourceGroup. +type ContainerAppsClientListByResourceGroupResult struct { + ContainerAppCollection +} + +// ContainerAppsClientListBySubscriptionResponse contains the response from method ContainerAppsClient.ListBySubscription. +type ContainerAppsClientListBySubscriptionResponse struct { + ContainerAppsClientListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsClientListBySubscriptionResult contains the result from method ContainerAppsClient.ListBySubscription. +type ContainerAppsClientListBySubscriptionResult struct { + ContainerAppCollection +} + +// ContainerAppsClientListCustomHostNameAnalysisResponse contains the response from method ContainerAppsClient.ListCustomHostNameAnalysis. +type ContainerAppsClientListCustomHostNameAnalysisResponse struct { + ContainerAppsClientListCustomHostNameAnalysisResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsClientListCustomHostNameAnalysisResult contains the result from method ContainerAppsClient.ListCustomHostNameAnalysis. +type ContainerAppsClientListCustomHostNameAnalysisResult struct { + CustomHostnameAnalysisResult +} + +// ContainerAppsClientListSecretsResponse contains the response from method ContainerAppsClient.ListSecrets. +type ContainerAppsClientListSecretsResponse struct { + ContainerAppsClientListSecretsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsClientListSecretsResult contains the result from method ContainerAppsClient.ListSecrets. +type ContainerAppsClientListSecretsResult struct { + SecretsCollection +} + +// ContainerAppsClientUpdateResponse contains the response from method ContainerAppsClient.Update. +type ContainerAppsClientUpdateResponse struct { + ContainerAppsClientUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsClientUpdateResult contains the result from method ContainerAppsClient.Update. +type ContainerAppsClientUpdateResult struct { + ContainerApp +} + +// ContainerAppsRevisionReplicasClientGetReplicaResponse contains the response from method ContainerAppsRevisionReplicasClient.GetReplica. +type ContainerAppsRevisionReplicasClientGetReplicaResponse struct { + ContainerAppsRevisionReplicasClientGetReplicaResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsRevisionReplicasClientGetReplicaResult contains the result from method ContainerAppsRevisionReplicasClient.GetReplica. +type ContainerAppsRevisionReplicasClientGetReplicaResult struct { + Replica +} + +// ContainerAppsRevisionReplicasClientListReplicasResponse contains the response from method ContainerAppsRevisionReplicasClient.ListReplicas. +type ContainerAppsRevisionReplicasClientListReplicasResponse struct { + ContainerAppsRevisionReplicasClientListReplicasResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsRevisionReplicasClientListReplicasResult contains the result from method ContainerAppsRevisionReplicasClient.ListReplicas. +type ContainerAppsRevisionReplicasClientListReplicasResult struct { + ReplicaCollection +} + +// ContainerAppsRevisionsClientActivateRevisionResponse contains the response from method ContainerAppsRevisionsClient.ActivateRevision. +type ContainerAppsRevisionsClientActivateRevisionResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsRevisionsClientDeactivateRevisionResponse contains the response from method ContainerAppsRevisionsClient.DeactivateRevision. +type ContainerAppsRevisionsClientDeactivateRevisionResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsRevisionsClientGetRevisionResponse contains the response from method ContainerAppsRevisionsClient.GetRevision. +type ContainerAppsRevisionsClientGetRevisionResponse struct { + ContainerAppsRevisionsClientGetRevisionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsRevisionsClientGetRevisionResult contains the result from method ContainerAppsRevisionsClient.GetRevision. +type ContainerAppsRevisionsClientGetRevisionResult struct { + Revision +} + +// ContainerAppsRevisionsClientListRevisionsResponse contains the response from method ContainerAppsRevisionsClient.ListRevisions. +type ContainerAppsRevisionsClientListRevisionsResponse struct { + ContainerAppsRevisionsClientListRevisionsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsRevisionsClientListRevisionsResult contains the result from method ContainerAppsRevisionsClient.ListRevisions. +type ContainerAppsRevisionsClientListRevisionsResult struct { + RevisionCollection +} + +// ContainerAppsRevisionsClientRestartRevisionResponse contains the response from method ContainerAppsRevisionsClient.RestartRevision. +type ContainerAppsRevisionsClientRestartRevisionResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse contains the response from method ContainerAppsSourceControlsClient.CreateOrUpdate. +type ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ContainerAppsSourceControlsClientCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ContainerAppsSourceControlsClientCreateOrUpdateResponse, error) { + respType := ContainerAppsSourceControlsClientCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SourceControl) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *ContainerAppsSourceControlsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ContainerAppsSourceControlsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ContainerAppsSourceControlsClient.CreateOrUpdate", token, client.pl) + if err != nil { + return err + } + poller := &ContainerAppsSourceControlsClientCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ContainerAppsSourceControlsClientCreateOrUpdateResponse contains the response from method ContainerAppsSourceControlsClient.CreateOrUpdate. +type ContainerAppsSourceControlsClientCreateOrUpdateResponse struct { + ContainerAppsSourceControlsClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsSourceControlsClientCreateOrUpdateResult contains the result from method ContainerAppsSourceControlsClient.CreateOrUpdate. +type ContainerAppsSourceControlsClientCreateOrUpdateResult struct { + SourceControl +} + +// ContainerAppsSourceControlsClientDeletePollerResponse contains the response from method ContainerAppsSourceControlsClient.Delete. +type ContainerAppsSourceControlsClientDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *ContainerAppsSourceControlsClientDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ContainerAppsSourceControlsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ContainerAppsSourceControlsClientDeleteResponse, error) { + respType := ContainerAppsSourceControlsClientDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ContainerAppsSourceControlsClientDeletePollerResponse from the provided client and resume token. +func (l *ContainerAppsSourceControlsClientDeletePollerResponse) Resume(ctx context.Context, client *ContainerAppsSourceControlsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ContainerAppsSourceControlsClient.Delete", token, client.pl) + if err != nil { + return err + } + poller := &ContainerAppsSourceControlsClientDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ContainerAppsSourceControlsClientDeleteResponse contains the response from method ContainerAppsSourceControlsClient.Delete. +type ContainerAppsSourceControlsClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsSourceControlsClientGetResponse contains the response from method ContainerAppsSourceControlsClient.Get. +type ContainerAppsSourceControlsClientGetResponse struct { + ContainerAppsSourceControlsClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsSourceControlsClientGetResult contains the result from method ContainerAppsSourceControlsClient.Get. +type ContainerAppsSourceControlsClientGetResult struct { + SourceControl +} + +// ContainerAppsSourceControlsClientListByContainerAppResponse contains the response from method ContainerAppsSourceControlsClient.ListByContainerApp. +type ContainerAppsSourceControlsClientListByContainerAppResponse struct { + ContainerAppsSourceControlsClientListByContainerAppResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContainerAppsSourceControlsClientListByContainerAppResult contains the result from method ContainerAppsSourceControlsClient.ListByContainerApp. +type ContainerAppsSourceControlsClientListByContainerAppResult struct { + SourceControlCollection +} + +// DaprComponentsClientCreateOrUpdateResponse contains the response from method DaprComponentsClient.CreateOrUpdate. +type DaprComponentsClientCreateOrUpdateResponse struct { + DaprComponentsClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DaprComponentsClientCreateOrUpdateResult contains the result from method DaprComponentsClient.CreateOrUpdate. +type DaprComponentsClientCreateOrUpdateResult struct { + DaprComponent +} + +// DaprComponentsClientDeleteResponse contains the response from method DaprComponentsClient.Delete. +type DaprComponentsClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DaprComponentsClientGetResponse contains the response from method DaprComponentsClient.Get. +type DaprComponentsClientGetResponse struct { + DaprComponentsClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DaprComponentsClientGetResult contains the result from method DaprComponentsClient.Get. +type DaprComponentsClientGetResult struct { + DaprComponent +} + +// DaprComponentsClientListResponse contains the response from method DaprComponentsClient.List. +type DaprComponentsClientListResponse struct { + DaprComponentsClientListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DaprComponentsClientListResult contains the result from method DaprComponentsClient.List. +type DaprComponentsClientListResult struct { + DaprComponentsCollection +} + +// ManagedEnvironmentsClientCreateOrUpdatePollerResponse contains the response from method ManagedEnvironmentsClient.CreateOrUpdate. +type ManagedEnvironmentsClientCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ManagedEnvironmentsClientCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ManagedEnvironmentsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedEnvironmentsClientCreateOrUpdateResponse, error) { + respType := ManagedEnvironmentsClientCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedEnvironment) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ManagedEnvironmentsClientCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *ManagedEnvironmentsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ManagedEnvironmentsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ManagedEnvironmentsClient.CreateOrUpdate", token, client.pl) + if err != nil { + return err + } + poller := &ManagedEnvironmentsClientCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ManagedEnvironmentsClientCreateOrUpdateResponse contains the response from method ManagedEnvironmentsClient.CreateOrUpdate. +type ManagedEnvironmentsClientCreateOrUpdateResponse struct { + ManagedEnvironmentsClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsClientCreateOrUpdateResult contains the result from method ManagedEnvironmentsClient.CreateOrUpdate. +type ManagedEnvironmentsClientCreateOrUpdateResult struct { + ManagedEnvironment +} + +// ManagedEnvironmentsClientDeletePollerResponse contains the response from method ManagedEnvironmentsClient.Delete. +type ManagedEnvironmentsClientDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *ManagedEnvironmentsClientDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ManagedEnvironmentsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedEnvironmentsClientDeleteResponse, error) { + respType := ManagedEnvironmentsClientDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ManagedEnvironmentsClientDeletePollerResponse from the provided client and resume token. +func (l *ManagedEnvironmentsClientDeletePollerResponse) Resume(ctx context.Context, client *ManagedEnvironmentsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ManagedEnvironmentsClient.Delete", token, client.pl) + if err != nil { + return err + } + poller := &ManagedEnvironmentsClientDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ManagedEnvironmentsClientDeleteResponse contains the response from method ManagedEnvironmentsClient.Delete. +type ManagedEnvironmentsClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsClientGetResponse contains the response from method ManagedEnvironmentsClient.Get. +type ManagedEnvironmentsClientGetResponse struct { + ManagedEnvironmentsClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsClientGetResult contains the result from method ManagedEnvironmentsClient.Get. +type ManagedEnvironmentsClientGetResult struct { + ManagedEnvironment +} + +// ManagedEnvironmentsClientListByResourceGroupResponse contains the response from method ManagedEnvironmentsClient.ListByResourceGroup. +type ManagedEnvironmentsClientListByResourceGroupResponse struct { + ManagedEnvironmentsClientListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsClientListByResourceGroupResult contains the result from method ManagedEnvironmentsClient.ListByResourceGroup. +type ManagedEnvironmentsClientListByResourceGroupResult struct { + ManagedEnvironmentsCollection +} + +// ManagedEnvironmentsClientListBySubscriptionResponse contains the response from method ManagedEnvironmentsClient.ListBySubscription. +type ManagedEnvironmentsClientListBySubscriptionResponse struct { + ManagedEnvironmentsClientListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsClientListBySubscriptionResult contains the result from method ManagedEnvironmentsClient.ListBySubscription. +type ManagedEnvironmentsClientListBySubscriptionResult struct { + ManagedEnvironmentsCollection +} + +// ManagedEnvironmentsClientUpdateResponse contains the response from method ManagedEnvironmentsClient.Update. +type ManagedEnvironmentsClientUpdateResponse struct { + ManagedEnvironmentsClientUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsClientUpdateResult contains the result from method ManagedEnvironmentsClient.Update. +type ManagedEnvironmentsClientUpdateResult struct { + ManagedEnvironment +} + +// ManagedEnvironmentsStoragesClientCreateOrUpdateResponse contains the response from method ManagedEnvironmentsStoragesClient.CreateOrUpdate. +type ManagedEnvironmentsStoragesClientCreateOrUpdateResponse struct { + ManagedEnvironmentsStoragesClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsStoragesClientCreateOrUpdateResult contains the result from method ManagedEnvironmentsStoragesClient.CreateOrUpdate. +type ManagedEnvironmentsStoragesClientCreateOrUpdateResult struct { + ManagedEnvironmentStorage +} + +// ManagedEnvironmentsStoragesClientDeleteResponse contains the response from method ManagedEnvironmentsStoragesClient.Delete. +type ManagedEnvironmentsStoragesClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsStoragesClientGetResponse contains the response from method ManagedEnvironmentsStoragesClient.Get. +type ManagedEnvironmentsStoragesClientGetResponse struct { + ManagedEnvironmentsStoragesClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsStoragesClientGetResult contains the result from method ManagedEnvironmentsStoragesClient.Get. +type ManagedEnvironmentsStoragesClientGetResult struct { + ManagedEnvironmentStorage +} + +// ManagedEnvironmentsStoragesClientListResponse contains the response from method ManagedEnvironmentsStoragesClient.List. +type ManagedEnvironmentsStoragesClientListResponse struct { + ManagedEnvironmentsStoragesClientListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ManagedEnvironmentsStoragesClientListResult contains the result from method ManagedEnvironmentsStoragesClient.List. +type ManagedEnvironmentsStoragesClientListResult struct { + ManagedEnvironmentStoragesCollection +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + OperationsClientListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsClientListResult contains the result from method OperationsClient.List. +type OperationsClientListResult 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..c69b9f43aeff --- /dev/null +++ b/sdk/resourcemanager/app/armapp/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.16 +// +build go1.16 + +// 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 +}