From f5dc33e7eefe98e54e64d9b2c84cd1803afe2318 Mon Sep 17 00:00:00 2001 From: ReleaseHelper Date: Tue, 9 May 2023 02:29:10 +0000 Subject: [PATCH] [Release] sdk/resourcemanager/appcontainers/armappcontainers/2.0.0-beta.3 generation from spec commit: 4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc --- .../armappcontainers/CHANGELOG.md | 86 + .../armappcontainers/autorest.md | 8 +- .../availableworkloadprofiles_client.go | 110 + ...bleworkloadprofiles_client_example_test.go | 176 + .../armappcontainers/billingmeters_client.go | 97 + .../billingmeters_client_example_test.go | 107 + .../armappcontainers/certificates_client.go | 20 +- .../certificates_client_example_test.go | 104 +- .../armappcontainers/client_factory.go | 64 +- .../connectedenvironments_client.go | 480 ++ ...nnectedenvironments_client_example_test.go | 357 ++ ...onnectedenvironmentscertificates_client.go | 362 ++ ...onmentscertificates_client_example_test.go | 223 + ...nectedenvironmentsdaprcomponents_client.go | 359 ++ ...mentsdaprcomponents_client_example_test.go | 272 ++ .../connectedenvironmentsstorages_client.go | 284 ++ ...nvironmentsstorages_client_example_test.go | 144 + .../armappcontainers/constants.go | 222 +- .../armappcontainers/containerapps_client.go | 106 +- .../containerapps_client_example_test.go | 711 ++- .../containerappsauthconfigs_client.go | 16 +- ...inerappsauthconfigs_client_example_test.go | 10 +- .../containerappsdiagnostics_client.go | 372 ++ ...inerappsdiagnostics_client_example_test.go | 384 ++ .../containerappsrevisionreplicas_client.go | 8 +- ...ppsrevisionreplicas_client_example_test.go | 10 +- .../containerappsrevisions_client.go | 20 +- ...tainerappsrevisions_client_example_test.go | 20 +- .../containerappssourcecontrols_client.go | 22 +- ...rappssourcecontrols_client_example_test.go | 10 +- .../armappcontainers/daprcomponents_client.go | 20 +- .../daprcomponents_client_example_test.go | 218 +- .../appcontainers/armappcontainers/go.mod | 2 +- .../armappcontainers/jobs_client.go | 689 +++ .../jobs_client_example_test.go | 716 +++ .../armappcontainers/jobsexecutions_client.go | 117 + .../jobsexecutions_client_example_test.go | 77 + .../managedcertificates_client.go | 370 ++ ...managedcertificates_client_example_test.go | 200 + .../managedenvironmentdiagnostics_client.go | 166 + ...ironmentdiagnostics_client_example_test.go | 135 + .../managedenvironments_client.go | 160 +- ...managedenvironments_client_example_test.go | 468 +- .../managedenvironmentsdiagnostics_client.go | 103 + ...ronmentsdiagnostics_client_example_test.go | 93 + .../managedenvironmentsstorages_client.go | 16 +- ...nvironmentsstorages_client_example_test.go | 10 +- .../appcontainers/armappcontainers/models.go | 2415 +++++++--- .../armappcontainers/models_serde.go | 4236 ++++++++++++++--- .../armappcontainers/namespaces_client.go | 4 +- .../namespaces_client_example_test.go | 6 +- .../armappcontainers/operations_client.go | 4 +- .../operations_client_example_test.go | 4 +- .../armappcontainers/response_types.go | 254 +- 54 files changed, 14086 insertions(+), 1561 deletions(-) create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go create mode 100644 sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md b/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md index 3dc0641e9487..8b023ece67d4 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md +++ b/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md @@ -1,5 +1,91 @@ # Release History +## 2.0.0-beta.3 (2023-05-26) +### Breaking Changes + +- Type of `BillingMeterProperties.Category` has been changed from `*Category` to `*string` +- Type of `CustomDomainConfiguration.CertificatePassword` has been changed from `[]byte` to `*string` +- Type of `DaprSecretsCollection.Value` has been changed from `[]*Secret` to `[]*DaprSecret` +- Enum `Category` has been removed +- Enum `ManagedEnvironmentOutBoundType` has been removed +- Enum `SKUName` has been removed +- Struct `EnvironmentSKUProperties` has been removed +- Struct `ManagedEnvironmentOutboundSettings` has been removed +- Field `BillingMeterCategory` of struct `AvailableWorkloadProfileProperties` has been removed +- Field `WorkloadProfileType` of struct `ContainerAppProperties` has been removed +- Field `SKU` of struct `ManagedEnvironment` has been removed +- Field `OutboundSettings`, `RuntimeSubnetID` of struct `VnetConfiguration` has been removed + +### Features Added + +- New value `StorageTypeSecret` added to enum type `StorageType` +- New enum type `Affinity` with values `AffinityNone`, `AffinitySticky` +- New enum type `IngressClientCertificateMode` with values `IngressClientCertificateModeAccept`, `IngressClientCertificateModeIgnore`, `IngressClientCertificateModeRequire` +- New enum type `JobExecutionRunningState` with values `JobExecutionRunningStateDegraded`, `JobExecutionRunningStateFailed`, `JobExecutionRunningStateProcessing`, `JobExecutionRunningStateRunning`, `JobExecutionRunningStateStopped`, `JobExecutionRunningStateSucceeded`, `JobExecutionRunningStateUnknown` +- New enum type `JobProvisioningState` with values `JobProvisioningStateCanceled`, `JobProvisioningStateDeleting`, `JobProvisioningStateFailed`, `JobProvisioningStateInProgress`, `JobProvisioningStateSucceeded` +- New enum type `ManagedCertificateDomainControlValidation` with values `ManagedCertificateDomainControlValidationCNAME`, `ManagedCertificateDomainControlValidationHTTP`, `ManagedCertificateDomainControlValidationTXT` +- New enum type `TriggerType` with values `TriggerTypeEvent`, `TriggerTypeManual`, `TriggerTypeScheduled` +- New function `*ClientFactory.NewJobsClient() *JobsClient` +- New function `*ClientFactory.NewJobsExecutionsClient() *JobsExecutionsClient` +- New function `*ClientFactory.NewManagedCertificatesClient() *ManagedCertificatesClient` +- New function `NewJobsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*JobsClient, error)` +- New function `*JobsClient.BeginCreateOrUpdate(context.Context, string, string, Job, *JobsClientBeginCreateOrUpdateOptions) (*runtime.Poller[JobsClientCreateOrUpdateResponse], error)` +- New function `*JobsClient.BeginDelete(context.Context, string, string, *JobsClientBeginDeleteOptions) (*runtime.Poller[JobsClientDeleteResponse], error)` +- New function `*JobsClient.Get(context.Context, string, string, *JobsClientGetOptions) (JobsClientGetResponse, error)` +- New function `*JobsClient.NewListByResourceGroupPager(string, *JobsClientListByResourceGroupOptions) *runtime.Pager[JobsClientListByResourceGroupResponse]` +- New function `*JobsClient.NewListBySubscriptionPager(*JobsClientListBySubscriptionOptions) *runtime.Pager[JobsClientListBySubscriptionResponse]` +- New function `*JobsClient.ListSecrets(context.Context, string, string, *JobsClientListSecretsOptions) (JobsClientListSecretsResponse, error)` +- New function `*JobsClient.BeginStart(context.Context, string, string, JobExecutionTemplate, *JobsClientBeginStartOptions) (*runtime.Poller[JobsClientStartResponse], error)` +- New function `*JobsClient.BeginStopExecution(context.Context, string, string, string, *JobsClientBeginStopExecutionOptions) (*runtime.Poller[JobsClientStopExecutionResponse], error)` +- New function `*JobsClient.BeginStopMultipleExecutions(context.Context, string, string, JobExecutionNamesCollection, *JobsClientBeginStopMultipleExecutionsOptions) (*runtime.Poller[JobsClientStopMultipleExecutionsResponse], error)` +- New function `*JobsClient.BeginUpdate(context.Context, string, string, JobPatchProperties, *JobsClientBeginUpdateOptions) (*runtime.Poller[JobsClientUpdateResponse], error)` +- New function `NewJobsExecutionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*JobsExecutionsClient, error)` +- New function `*JobsExecutionsClient.NewListPager(string, string, *JobsExecutionsClientListOptions) *runtime.Pager[JobsExecutionsClientListResponse]` +- New function `NewManagedCertificatesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedCertificatesClient, error)` +- New function `*ManagedCertificatesClient.BeginCreateOrUpdate(context.Context, string, string, string, *ManagedCertificatesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedCertificatesClientCreateOrUpdateResponse], error)` +- New function `*ManagedCertificatesClient.Delete(context.Context, string, string, string, *ManagedCertificatesClientDeleteOptions) (ManagedCertificatesClientDeleteResponse, error)` +- New function `*ManagedCertificatesClient.Get(context.Context, string, string, string, *ManagedCertificatesClientGetOptions) (ManagedCertificatesClientGetResponse, error)` +- New function `*ManagedCertificatesClient.NewListPager(string, string, *ManagedCertificatesClientListOptions) *runtime.Pager[ManagedCertificatesClientListResponse]` +- New function `*ManagedCertificatesClient.Update(context.Context, string, string, string, ManagedCertificatePatch, *ManagedCertificatesClientUpdateOptions) (ManagedCertificatesClientUpdateResponse, error)` +- New struct `ContainerAppJobExecutions` +- New struct `CorsPolicy` +- New struct `DaprConfiguration` +- New struct `IngressStickySessions` +- New struct `Job` +- New struct `JobConfiguration` +- New struct `JobConfigurationManualTriggerConfig` +- New struct `JobConfigurationScheduleTriggerConfig` +- New struct `JobExecution` +- New struct `JobExecutionBase` +- New struct `JobExecutionContainer` +- New struct `JobExecutionNamesCollection` +- New struct `JobExecutionTemplate` +- New struct `JobPatchProperties` +- New struct `JobPatchPropertiesProperties` +- New struct `JobProperties` +- New struct `JobSecretsCollection` +- New struct `JobTemplate` +- New struct `JobsCollection` +- New struct `KedaConfiguration` +- New struct `ManagedCertificate` +- New struct `ManagedCertificateCollection` +- New struct `ManagedCertificatePatch` +- New struct `ManagedCertificateProperties` +- New struct `SecretVolumeItem` +- New field `Category` in struct `AvailableWorkloadProfileProperties` +- New field `ManagedBy` in struct `ContainerApp` +- New field `LatestReadyRevisionName`, `WorkloadProfileName` in struct `ContainerAppProperties` +- New field `Identity`, `KeyVaultURL` in struct `ContainerAppSecret` +- New anonymous field `ContainerApp` in struct `ContainerAppsClientUpdateResponse` +- New field `ClientCertificateMode`, `CorsPolicy`, `StickySessions` in struct `Ingress` +- New field `Kind` in struct `ManagedEnvironment` +- New field `DaprConfiguration`, `InfrastructureResourceGroup`, `KedaConfiguration` in struct `ManagedEnvironmentProperties` +- New anonymous field `ManagedEnvironment` in struct `ManagedEnvironmentsClientUpdateResponse` +- New field `Identity`, `KeyVaultURL` in struct `Secret` +- New field `Secrets` in struct `Volume` +- New field `Name` in struct `WorkloadProfile` + + ## 1.1.0 (2023-04-07) ### Features Added diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md b/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md index 9bbf61f84709..c8092ed50e49 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md +++ b/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 - +module-version: 2.0.0-beta.3 +tag: package-preview-2022-11 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go new file mode 100644 index 000000000000..b790d2a784c3 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailableWorkloadProfilesClient contains the methods for the AvailableWorkloadProfiles group. +// Don't use this type directly, use NewAvailableWorkloadProfilesClient() instead. +type AvailableWorkloadProfilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAvailableWorkloadProfilesClient creates a new instance of AvailableWorkloadProfilesClient 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 NewAvailableWorkloadProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableWorkloadProfilesClient, error) { + cl, err := arm.NewClient(moduleName+".AvailableWorkloadProfilesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailableWorkloadProfilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewGetPager - Get all available workload profiles for a location. +// +// Generated from API version 2022-11-01-preview +// - location - The name of Azure region. +// - options - AvailableWorkloadProfilesClientGetOptions contains the optional parameters for the AvailableWorkloadProfilesClient.NewGetPager +// method. +func (client *AvailableWorkloadProfilesClient) NewGetPager(location string, options *AvailableWorkloadProfilesClientGetOptions) *runtime.Pager[AvailableWorkloadProfilesClientGetResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableWorkloadProfilesClientGetResponse]{ + More: func(page AvailableWorkloadProfilesClientGetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableWorkloadProfilesClientGetResponse) (AvailableWorkloadProfilesClientGetResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableWorkloadProfilesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailableWorkloadProfilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableWorkloadProfilesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) + }, + }) +} + +// getCreateRequest creates the Get request. +func (client *AvailableWorkloadProfilesClient) getCreateRequest(ctx context.Context, location string, options *AvailableWorkloadProfilesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AvailableWorkloadProfilesClient) getHandleResponse(resp *http.Response) (AvailableWorkloadProfilesClientGetResponse, error) { + result := AvailableWorkloadProfilesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableWorkloadProfilesCollection); err != nil { + return AvailableWorkloadProfilesClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go new file mode 100644 index 000000000000..8923fbaf6b8b --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go @@ -0,0 +1,176 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AvailableWorkloadProfiles_Get.json +func ExampleAvailableWorkloadProfilesClient_NewGetPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAvailableWorkloadProfilesClient().NewGetPager("East US", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AvailableWorkloadProfilesCollection = armappcontainers.AvailableWorkloadProfilesCollection{ + // Value: []*armappcontainers.AvailableWorkloadProfile{ + // { + // Name: to.Ptr("Dedicated-D4"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-D4"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityLocationDefault), + // Category: to.Ptr("General purpose D-series"), + // Cores: to.Ptr[int32](4), + // DisplayName: to.Ptr("Dedicated-D4"), + // MemoryGiB: to.Ptr[int32](16), + // }, + // }, + // { + // Name: to.Ptr("Dedicated-D4"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-D8"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("General purpose D-series"), + // Cores: to.Ptr[int32](8), + // DisplayName: to.Ptr("Dedicated-D8"), + // MemoryGiB: to.Ptr[int32](32), + // }, + // }, + // { + // Name: to.Ptr("Dedicated-D16"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-D16"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("General purpose D-series"), + // Cores: to.Ptr[int32](16), + // DisplayName: to.Ptr("Dedicated-D16"), + // MemoryGiB: to.Ptr[int32](64), + // }, + // }, + // { + // Name: to.Ptr("Dedicated-E4"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-E4"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("Memory optimized E-series"), + // Cores: to.Ptr[int32](4), + // DisplayName: to.Ptr("Dedicated-E4"), + // MemoryGiB: to.Ptr[int32](32), + // }, + // }, + // { + // Name: to.Ptr("Dedicated-E8"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-E8"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("Memory optimized E-series"), + // Cores: to.Ptr[int32](8), + // DisplayName: to.Ptr("Dedicated-E8"), + // MemoryGiB: to.Ptr[int32](64), + // }, + // }, + // { + // Name: to.Ptr("Dedicated-E16"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-E16"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("Memory optimized E-series"), + // Cores: to.Ptr[int32](16), + // DisplayName: to.Ptr("Dedicated-E16"), + // MemoryGiB: to.Ptr[int32](128), + // }, + // }, + // { + // Name: to.Ptr("Dedicated-F4"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-F4"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("Compute optimized F-series"), + // Cores: to.Ptr[int32](4), + // DisplayName: to.Ptr("Dedicated-F4"), + // MemoryGiB: to.Ptr[int32](8), + // }, + // }, + // { + // Name: to.Ptr("Dedicated-F8"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-F8"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("Compute optimized F-series"), + // Cores: to.Ptr[int32](8), + // DisplayName: to.Ptr("Dedicated-F8"), + // MemoryGiB: to.Ptr[int32](16), + // }, + // }, + // { + // Name: to.Ptr("Dedicated-F16"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Dedicated-F16"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("Compute optimized F-series"), + // Cores: to.Ptr[int32](16), + // DisplayName: to.Ptr("Dedicated-F16"), + // MemoryGiB: to.Ptr[int32](32), + // }, + // }, + // { + // Name: to.Ptr("Consumption"), + // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/Consumption"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ + // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), + // Category: to.Ptr("Consumption"), + // Cores: to.Ptr[int32](3), + // DisplayName: to.Ptr("Consumption"), + // MemoryGiB: to.Ptr[int32](3), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go new file mode 100644 index 000000000000..a1f7c9be4a31 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go @@ -0,0 +1,97 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BillingMetersClient contains the methods for the BillingMeters group. +// Don't use this type directly, use NewBillingMetersClient() instead. +type BillingMetersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBillingMetersClient creates a new instance of BillingMetersClient 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 NewBillingMetersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BillingMetersClient, error) { + cl, err := arm.NewClient(moduleName+".BillingMetersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BillingMetersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get all billingMeters for a location. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - location - The name of Azure region. +// - options - BillingMetersClientGetOptions contains the optional parameters for the BillingMetersClient.Get method. +func (client *BillingMetersClient) Get(ctx context.Context, location string, options *BillingMetersClientGetOptions) (BillingMetersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, options) + if err != nil { + return BillingMetersClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BillingMetersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BillingMetersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *BillingMetersClient) getCreateRequest(ctx context.Context, location string, options *BillingMetersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BillingMetersClient) getHandleResponse(resp *http.Response) (BillingMetersClientGetResponse, error) { + result := BillingMetersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BillingMeterCollection); err != nil { + return BillingMetersClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go new file mode 100644 index 000000000000..28391eb2b4a1 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go @@ -0,0 +1,107 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/BillingMeters_Get.json +func ExampleBillingMetersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBillingMetersClient().Get(ctx, "East US", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.BillingMeterCollection = armappcontainers.BillingMeterCollection{ + // Value: []*armappcontainers.BillingMeter{ + // { + // Name: to.Ptr("GeneralPurposeDseriesCPU"), + // Type: to.Ptr("Microsoft.App/billingMeters"), + // ID: to.Ptr("/subscriptions/55f240e3-3d66-44f6-8358-4e4f3d7a2e51/providers/Microsoft.App/GeneralPurposeDseriesCPU"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.BillingMeterProperties{ + // Category: to.Ptr("General purpose D-series"), + // DisplayName: to.Ptr("General Purpose Cores per Second"), + // MeterType: to.Ptr("CPU"), + // }, + // }, + // { + // Name: to.Ptr("GeneralPurposeDseriesMemory"), + // Type: to.Ptr("Microsoft.App/billingMeters"), + // ID: to.Ptr("/subscriptions/55f240e3-3d66-44f6-8358-4e4f3d7a2e51/providers/Microsoft.App/GeneralPurposeDseriesMemory"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.BillingMeterProperties{ + // Category: to.Ptr("General purpose D-series"), + // DisplayName: to.Ptr("General Purpose Memory GiB per Second"), + // MeterType: to.Ptr("Memory"), + // }, + // }, + // { + // Name: to.Ptr("MemoryOptimizedEseriesCPU"), + // Type: to.Ptr("Microsoft.App/billingMeters"), + // ID: to.Ptr("/subscriptions/55f240e3-3d66-44f6-8358-4e4f3d7a2e51/providers/Microsoft.App/MemoryOptimizedEseriesCPU"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.BillingMeterProperties{ + // Category: to.Ptr("Memory optimized E-series"), + // DisplayName: to.Ptr("Memory Optimized Cores per Second"), + // MeterType: to.Ptr("CPU"), + // }, + // }, + // { + // Name: to.Ptr("MemoryOptimizedEseriesMemory"), + // Type: to.Ptr("Microsoft.App/billingMeters"), + // ID: to.Ptr("/subscriptions/55f240e3-3d66-44f6-8358-4e4f3d7a2e51/providers/Microsoft.App/MemoryOptimizedEseriesMemory"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.BillingMeterProperties{ + // Category: to.Ptr("Memory optimized E-series"), + // DisplayName: to.Ptr("Memory Optimized Memory GiB per Second"), + // MeterType: to.Ptr("Memory"), + // }, + // }, + // { + // Name: to.Ptr("ComputeOptimizedFseriesCPU"), + // Type: to.Ptr("Microsoft.App/billingMeters"), + // ID: to.Ptr("/subscriptions/55f240e3-3d66-44f6-8358-4e4f3d7a2e51/providers/Microsoft.App/ComputeOptimizedFseriesCPU"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.BillingMeterProperties{ + // Category: to.Ptr("Compute optimized F-series"), + // DisplayName: to.Ptr("Compute Optimized Cores per Second"), + // MeterType: to.Ptr("CPU"), + // }, + // }, + // { + // Name: to.Ptr("GeneralComputeMemory"), + // Type: to.Ptr("Microsoft.App/billingMeters"), + // ID: to.Ptr("/subscriptions/55f240e3-3d66-44f6-8358-4e4f3d7a2e51/providers/Microsoft.App/GeneralComputeMemory"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.BillingMeterProperties{ + // Category: to.Ptr("Compute optimized F-series"), + // DisplayName: to.Ptr("Compute Optimized Memory GiB per Second"), + // MeterType: to.Ptr("Memory"), + // }, + // }}, + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go index 12aefe799a7c..d6bd00f1744b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go @@ -47,7 +47,7 @@ func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or Update a Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - certificateName - Name of the Certificate. @@ -92,7 +92,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.CertificateEnvelope != nil { @@ -113,7 +113,7 @@ func (client *CertificatesClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Deletes the specified Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - certificateName - Name of the Certificate. @@ -157,7 +157,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -166,7 +166,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou // Get - Get the specified Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - certificateName - Name of the Certificate. @@ -210,7 +210,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -227,7 +227,7 @@ func (client *CertificatesClient) getHandleResponse(resp *http.Response) (Certif // NewListPager - Get the Certificates in a given managed environment. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - options - CertificatesClientListOptions contains the optional parameters for the CertificatesClient.NewListPager method. @@ -279,7 +279,7 @@ func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -297,7 +297,7 @@ func (client *CertificatesClient) listHandleResponse(resp *http.Response) (Certi // Update - Patches a certificate. Currently only patching of tags is supported // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - certificateName - Name of the Certificate. @@ -342,7 +342,7 @@ func (client *CertificatesClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, certificateEnvelope) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go index d57306ea7712..3fcbf2d0ddab 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Certificates_ListByManagedEnvironment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_ListByManagedEnvironment.json func ExampleCertificatesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -43,40 +43,44 @@ func ExampleCertificatesClient_NewListPager() { // page.CertificateCollection = armappcontainers.CertificateCollection{ // Value: []*armappcontainers.Certificate{ // { - // Name: to.Ptr("certificate-firendly-name1"), + // Name: to.Ptr("certificate-firendly-name"), // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name1"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), // Location: to.Ptr("East US"), // Properties: &armappcontainers.CertificateProperties{ // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), // Issuer: to.Ptr("Issuer Name"), // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), - // SubjectName: to.Ptr("my-subject-name1.contoso.com"), - // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), - // Valid: to.Ptr(true), + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, // }, - // }, - // { - // Name: to.Ptr("certificate-firendly-name2"), - // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name2"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.CertificateProperties{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), - // Issuer: to.Ptr("Issuer Name"), - // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), - // SubjectName: to.Ptr("my-subject-name2.contoso.com"), - // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), - // Valid: to.Ptr(true), - // }, - // }}, - // } + // { + // Name: to.Ptr("certificate-firendly-name"), + // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.CertificateProperties{ + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), + // Issuer: to.Ptr("Issuer Name"), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Certificate_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Get.json func ExampleCertificatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -97,21 +101,23 @@ func ExampleCertificatesClient_Get() { // res.Certificate = armappcontainers.Certificate{ // Name: to.Ptr("certificate-firendly-name"), // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), // Location: to.Ptr("East US"), // Properties: &armappcontainers.CertificateProperties{ // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), // Issuer: to.Ptr("Issuer Name"), // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), - // SubjectName: to.Ptr("my-subject-name.contoso.com"), - // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), - // Valid: to.Ptr(true), - // }, - // } + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Certificate_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_CreateOrUpdate.json func ExampleCertificatesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -126,7 +132,7 @@ func ExampleCertificatesClient_CreateOrUpdate() { Location: to.Ptr("East US"), Properties: &armappcontainers.CertificateProperties{ Password: to.Ptr("private key password"), - Value: []byte("PFX-or-PEM-blob"), + Value: []byte("Y2VydA=="), }, }, }) @@ -138,21 +144,23 @@ func ExampleCertificatesClient_CreateOrUpdate() { // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.Certificate = armappcontainers.Certificate{ // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), // Location: to.Ptr("East US"), // Properties: &armappcontainers.CertificateProperties{ // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), // Issuer: to.Ptr("Issuer Name"), // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), - // SubjectName: to.Ptr("my-subject-name.contoso.com"), - // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), - // Valid: to.Ptr(true), - // }, - // } + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Certificate_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Delete.json func ExampleCertificatesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -169,7 +177,7 @@ func ExampleCertificatesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Certificates_Patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_Patch.json func ExampleCertificatesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -194,7 +202,7 @@ func ExampleCertificatesClient_Update() { // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.Certificate = armappcontainers.Certificate{ // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), // Location: to.Ptr("East US"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -205,9 +213,11 @@ func ExampleCertificatesClient_Update() { // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), // Issuer: to.Ptr("Issuer Name"), // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), - // SubjectName: to.Ptr("my-subject-name.contoso.com"), - // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), - // Valid: to.Ptr(true), - // }, - // } + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // } } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go b/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go index cf00001920dc..a1c8d05e3f36 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go @@ -43,11 +43,51 @@ func (c *ClientFactory) NewContainerAppsAuthConfigsClient() *ContainerAppsAuthCo return subClient } +func (c *ClientFactory) NewAvailableWorkloadProfilesClient() *AvailableWorkloadProfilesClient { + subClient, _ := NewAvailableWorkloadProfilesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBillingMetersClient() *BillingMetersClient { + subClient, _ := NewBillingMetersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewConnectedEnvironmentsClient() *ConnectedEnvironmentsClient { + subClient, _ := NewConnectedEnvironmentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewConnectedEnvironmentsCertificatesClient() *ConnectedEnvironmentsCertificatesClient { + subClient, _ := NewConnectedEnvironmentsCertificatesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewConnectedEnvironmentsDaprComponentsClient() *ConnectedEnvironmentsDaprComponentsClient { + subClient, _ := NewConnectedEnvironmentsDaprComponentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewConnectedEnvironmentsStoragesClient() *ConnectedEnvironmentsStoragesClient { + subClient, _ := NewConnectedEnvironmentsStoragesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewContainerAppsClient() *ContainerAppsClient { subClient, _ := NewContainerAppsClient(c.subscriptionID, c.credential, c.options) return subClient } +func (c *ClientFactory) NewJobsClient() *JobsClient { + subClient, _ := NewJobsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewJobsExecutionsClient() *JobsExecutionsClient { + subClient, _ := NewJobsExecutionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewContainerAppsRevisionsClient() *ContainerAppsRevisionsClient { subClient, _ := NewContainerAppsRevisionsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -58,8 +98,18 @@ func (c *ClientFactory) NewContainerAppsRevisionReplicasClient() *ContainerAppsR return subClient } -func (c *ClientFactory) NewDaprComponentsClient() *DaprComponentsClient { - subClient, _ := NewDaprComponentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewContainerAppsDiagnosticsClient() *ContainerAppsDiagnosticsClient { + subClient, _ := NewContainerAppsDiagnosticsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewManagedEnvironmentDiagnosticsClient() *ManagedEnvironmentDiagnosticsClient { + subClient, _ := NewManagedEnvironmentDiagnosticsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewManagedEnvironmentsDiagnosticsClient() *ManagedEnvironmentsDiagnosticsClient { + subClient, _ := NewManagedEnvironmentsDiagnosticsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -78,11 +128,21 @@ func (c *ClientFactory) NewCertificatesClient() *CertificatesClient { return subClient } +func (c *ClientFactory) NewManagedCertificatesClient() *ManagedCertificatesClient { + subClient, _ := NewManagedCertificatesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewNamespacesClient() *NamespacesClient { subClient, _ := NewNamespacesClient(c.subscriptionID, c.credential, c.options) return subClient } +func (c *ClientFactory) NewDaprComponentsClient() *DaprComponentsClient { + subClient, _ := NewDaprComponentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewManagedEnvironmentsStoragesClient() *ManagedEnvironmentsStoragesClient { subClient, _ := NewManagedEnvironmentsStoragesClient(c.subscriptionID, c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go new file mode 100644 index 000000000000..504d0e783729 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go @@ -0,0 +1,480 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ConnectedEnvironmentsClient contains the methods for the ConnectedEnvironments group. +// Don't use this type directly, use NewConnectedEnvironmentsClient() instead. +type ConnectedEnvironmentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewConnectedEnvironmentsClient creates a new instance of ConnectedEnvironmentsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewConnectedEnvironmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsClient, error) { + cl, err := arm.NewClient(moduleName+".ConnectedEnvironmentsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ConnectedEnvironmentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Checks if resource connectedEnvironmentName is available. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Managed Environment. +// - checkNameAvailabilityRequest - The check connectedEnvironmentName availability request. +// - options - ConnectedEnvironmentsClientCheckNameAvailabilityOptions contains the optional parameters for the ConnectedEnvironmentsClient.CheckNameAvailability +// method. +func (client *ConnectedEnvironmentsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ConnectedEnvironmentsClientCheckNameAvailabilityOptions) (ConnectedEnvironmentsClientCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, checkNameAvailabilityRequest, options) + if err != nil { + return ConnectedEnvironmentsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *ConnectedEnvironmentsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ConnectedEnvironmentsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *ConnectedEnvironmentsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientCheckNameAvailabilityResponse, error) { + result := ConnectedEnvironmentsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return ConnectedEnvironmentsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreateOrUpdate - Creates or updates an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connectedEnvironment. +// - environmentEnvelope - Configuration details of the connectedEnvironment. +// - options - ConnectedEnvironmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsClient.BeginCreateOrUpdate +// method. +func (client *ConnectedEnvironmentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, environmentEnvelope ConnectedEnvironment, options *ConnectedEnvironmentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConnectedEnvironmentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, connectedEnvironmentName, environmentEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectedEnvironmentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ConnectedEnvironmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, environmentEnvelope ConnectedEnvironment, options *ConnectedEnvironmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, environmentEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectedEnvironmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, environmentEnvelope ConnectedEnvironment, options *ConnectedEnvironmentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, environmentEnvelope) +} + +// BeginDelete - Delete an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connectedEnvironment. +// - options - ConnectedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsClient.BeginDelete +// method. +func (client *ConnectedEnvironmentsClient) BeginDelete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*runtime.Poller[ConnectedEnvironmentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectedEnvironmentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ConnectedEnvironmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the properties of an connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connectedEnvironment. +// - options - ConnectedEnvironmentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsClient.Get +// method. +func (client *ConnectedEnvironmentsClient) Get(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientGetOptions) (ConnectedEnvironmentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return ConnectedEnvironmentsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectedEnvironmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectedEnvironmentsClient) getHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientGetResponse, error) { + result := ConnectedEnvironmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironment); err != nil { + return ConnectedEnvironmentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all connectedEnvironments in a resource group. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ConnectedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ConnectedEnvironmentsClient.NewListByResourceGroupPager +// method. +func (client *ConnectedEnvironmentsClient) NewListByResourceGroupPager(resourceGroupName string, options *ConnectedEnvironmentsClientListByResourceGroupOptions) *runtime.Pager[ConnectedEnvironmentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectedEnvironmentsClientListByResourceGroupResponse]{ + More: func(page ConnectedEnvironmentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectedEnvironmentsClientListByResourceGroupResponse) (ConnectedEnvironmentsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectedEnvironmentsClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ConnectedEnvironmentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ConnectedEnvironmentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ConnectedEnvironmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientListByResourceGroupResponse, error) { + result := ConnectedEnvironmentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentCollection); err != nil { + return ConnectedEnvironmentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get all connectedEnvironments for a subscription. +// +// Generated from API version 2022-11-01-preview +// - options - ConnectedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ConnectedEnvironmentsClient.NewListBySubscriptionPager +// method. +func (client *ConnectedEnvironmentsClient) NewListBySubscriptionPager(options *ConnectedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ConnectedEnvironmentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectedEnvironmentsClientListBySubscriptionResponse]{ + More: func(page ConnectedEnvironmentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectedEnvironmentsClientListBySubscriptionResponse) (ConnectedEnvironmentsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectedEnvironmentsClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ConnectedEnvironmentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ConnectedEnvironmentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ConnectedEnvironmentsClient) listBySubscriptionHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientListBySubscriptionResponse, error) { + result := ConnectedEnvironmentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentCollection); err != nil { + return ConnectedEnvironmentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Patches a Managed Environment. Only patching of tags is supported currently +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connectedEnvironment. +// - options - ConnectedEnvironmentsClientUpdateOptions contains the optional parameters for the ConnectedEnvironmentsClient.Update +// method. +func (client *ConnectedEnvironmentsClient) Update(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientUpdateOptions) (ConnectedEnvironmentsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return ConnectedEnvironmentsClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ConnectedEnvironmentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ConnectedEnvironmentsClient) updateHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientUpdateResponse, error) { + result := ConnectedEnvironmentsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironment); err != nil { + return ConnectedEnvironmentsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go new file mode 100644 index 000000000000..9f11704bfb59 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go @@ -0,0 +1,357 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListBySubscription.json +func ExampleConnectedEnvironmentsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewConnectedEnvironmentsClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ConnectedEnvironmentCollection = armappcontainers.ConnectedEnvironmentCollection{ + // Value: []*armappcontainers.ConnectedEnvironment{ + // { + // Name: to.Ptr("sample1"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/sample1"), + // Location: to.Ptr("North Central US"), + // Tags: map[string]*string{ + // }, + // Properties: &armappcontainers.ConnectedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("sample1.k4apps.io"), + // ProvisioningState: to.Ptr(armappcontainers.ConnectedEnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("20.42.33.145"), + // }, + // }, + // { + // Name: to.Ptr("sample2"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/DemoRG/providers/Microsoft.App/connectedEnvironments/sample2"), + // Location: to.Ptr("North Central US"), + // Tags: map[string]*string{ + // }, + // Properties: &armappcontainers.ConnectedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name2.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name2.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("sample2.k4apps.io"), + // ProvisioningState: to.Ptr(armappcontainers.ConnectedEnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("52.142.21.61"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListByResourceGroup.json +func ExampleConnectedEnvironmentsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewConnectedEnvironmentsClient().NewListByResourceGroupPager("examplerg", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ConnectedEnvironmentCollection = armappcontainers.ConnectedEnvironmentCollection{ + // Value: []*armappcontainers.ConnectedEnvironment{ + // { + // Name: to.Ptr("sample1"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/sample1"), + // Location: to.Ptr("North Central US"), + // Tags: map[string]*string{ + // }, + // ExtendedLocation: &armappcontainers.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation"), + // Type: to.Ptr(armappcontainers.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armappcontainers.ConnectedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("sample1.k4apps.io"), + // ProvisioningState: to.Ptr(armappcontainers.ConnectedEnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("20.42.33.145"), + // }, + // }, + // { + // Name: to.Ptr("sample2"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/sample2"), + // Location: to.Ptr("North Central US"), + // Tags: map[string]*string{ + // }, + // ExtendedLocation: &armappcontainers.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation"), + // Type: to.Ptr(armappcontainers.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armappcontainers.ConnectedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name2.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name2.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("sample2.k4apps.io"), + // ProvisioningState: to.Ptr(armappcontainers.ConnectedEnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("52.142.21.61"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Get.json +func ExampleConnectedEnvironmentsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsClient().Get(ctx, "examplerg", "examplekenv", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ConnectedEnvironment = armappcontainers.ConnectedEnvironment{ + // Name: to.Ptr("examplekenv"), + // Type: to.Ptr("Microsoft.App/kubeEnvironments"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/kubeEnvironments/examplekenv"), + // Location: to.Ptr("North Central US"), + // Tags: map[string]*string{ + // }, + // ExtendedLocation: &armappcontainers.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation"), + // Type: to.Ptr(armappcontainers.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armappcontainers.ConnectedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("examplekenv.k4apps.io"), + // ProvisioningState: to.Ptr(armappcontainers.ConnectedEnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("20.42.33.145"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_CreateOrUpdate.json +func ExampleConnectedEnvironmentsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewConnectedEnvironmentsClient().BeginCreateOrUpdate(ctx, "examplerg", "testenv", armappcontainers.ConnectedEnvironment{ + Location: to.Ptr("East US"), + Properties: &armappcontainers.ConnectedEnvironmentProperties{ + CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + CertificatePassword: to.Ptr("private key password"), + CertificateValue: []byte("Y2VydA=="), + DNSSuffix: to.Ptr("www.my-name.com"), + }, + DaprAIConnectionString: to.Ptr("InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/"), + StaticIP: to.Ptr("1.2.3.4"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ConnectedEnvironment = armappcontainers.ConnectedEnvironment{ + // Name: to.Ptr("testenv"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testenv"), + // Location: to.Ptr("East US"), + // Tags: map[string]*string{ + // }, + // ExtendedLocation: &armappcontainers.ExtendedLocation{ + // Name: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation"), + // Type: to.Ptr(armappcontainers.ExtendedLocationTypesCustomLocation), + // }, + // Properties: &armappcontainers.ConnectedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("testenv.k4apps.io"), + // ProvisioningState: to.Ptr(armappcontainers.ConnectedEnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("1.2.3.4"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Delete.json +func ExampleConnectedEnvironmentsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewConnectedEnvironmentsClient().BeginDelete(ctx, "examplerg", "examplekenv", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Patch.json +func ExampleConnectedEnvironmentsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsClient().Update(ctx, "examplerg", "testenv", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ConnectedEnvironment = armappcontainers.ConnectedEnvironment{ + // Name: to.Ptr("testenv"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testenv"), + // Location: to.Ptr("East US"), + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // Properties: &armappcontainers.ConnectedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("testenv.k4apps.io"), + // ProvisioningState: to.Ptr(armappcontainers.ConnectedEnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("20.42.33.145"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +func ExampleConnectedEnvironmentsClient_CheckNameAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsClient().CheckNameAvailability(ctx, "examplerg", "testcontainerenv", armappcontainers.CheckNameAvailabilityRequest{ + Name: to.Ptr("testcertificatename"), + Type: to.Ptr("Microsoft.App/connectedEnvironments/certificates"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CheckNameAvailabilityResponse = armappcontainers.CheckNameAvailabilityResponse{ + // Message: to.Ptr(""), + // NameAvailable: to.Ptr(true), + // Reason: to.Ptr(armappcontainers.CheckNameAvailabilityReason("None")), + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go new file mode 100644 index 000000000000..be401cfd9bd8 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go @@ -0,0 +1,362 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ConnectedEnvironmentsCertificatesClient contains the methods for the ConnectedEnvironmentsCertificates group. +// Don't use this type directly, use NewConnectedEnvironmentsCertificatesClient() instead. +type ConnectedEnvironmentsCertificatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewConnectedEnvironmentsCertificatesClient creates a new instance of ConnectedEnvironmentsCertificatesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewConnectedEnvironmentsCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsCertificatesClient, error) { + cl, err := arm.NewClient(moduleName+".ConnectedEnvironmentsCertificatesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ConnectedEnvironmentsCertificatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or Update a Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Connected Environment. +// - certificateName - Name of the Certificate. +// - options - ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.CreateOrUpdate +// method. +func (client *ConnectedEnvironmentsCertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions) (ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) + if err != nil { + return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.CertificateEnvelope != nil { + return req, runtime.MarshalAsJSON(req, *options.CertificateEnvelope) + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse, error) { + result := ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Connected Environment. +// - certificateName - Name of the Certificate. +// - options - ConnectedEnvironmentsCertificatesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Delete +// method. +func (client *ConnectedEnvironmentsCertificatesClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientDeleteOptions) (ConnectedEnvironmentsCertificatesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) + if err != nil { + return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectedEnvironmentsCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Connected Environment. +// - certificateName - Name of the Certificate. +// - options - ConnectedEnvironmentsCertificatesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Get +// method. +func (client *ConnectedEnvironmentsCertificatesClient) Get(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientGetOptions) (ConnectedEnvironmentsCertificatesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) + if err != nil { + return ConnectedEnvironmentsCertificatesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsCertificatesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectedEnvironmentsCertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectedEnvironmentsCertificatesClient) getHandleResponse(resp *http.Response) (ConnectedEnvironmentsCertificatesClientGetResponse, error) { + result := ConnectedEnvironmentsCertificatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return ConnectedEnvironmentsCertificatesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Certificates in a given connected environment. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Connected Environment. +// - options - ConnectedEnvironmentsCertificatesClientListOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.NewListPager +// method. +func (client *ConnectedEnvironmentsCertificatesClient) NewListPager(resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsCertificatesClientListOptions) *runtime.Pager[ConnectedEnvironmentsCertificatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectedEnvironmentsCertificatesClientListResponse]{ + More: func(page ConnectedEnvironmentsCertificatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectedEnvironmentsCertificatesClientListResponse) (ConnectedEnvironmentsCertificatesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectedEnvironmentsCertificatesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsCertificatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectedEnvironmentsCertificatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsCertificatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConnectedEnvironmentsCertificatesClient) listHandleResponse(resp *http.Response) (ConnectedEnvironmentsCertificatesClientListResponse, error) { + result := ConnectedEnvironmentsCertificatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateCollection); err != nil { + return ConnectedEnvironmentsCertificatesClientListResponse{}, err + } + return result, nil +} + +// Update - Patches a certificate. Currently only patching of tags is supported +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Connected Environment. +// - certificateName - Name of the Certificate. +// - certificateEnvelope - Properties of a certificate that need to be updated +// - options - ConnectedEnvironmentsCertificatesClientUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Update +// method. +func (client *ConnectedEnvironmentsCertificatesClient) Update(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope CertificatePatch, options *ConnectedEnvironmentsCertificatesClientUpdateOptions) (ConnectedEnvironmentsCertificatesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, certificateEnvelope, options) + if err != nil { + return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ConnectedEnvironmentsCertificatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope CertificatePatch, options *ConnectedEnvironmentsCertificatesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, certificateEnvelope) +} + +// updateHandleResponse handles the Update response. +func (client *ConnectedEnvironmentsCertificatesClient) updateHandleResponse(resp *http.Response) (ConnectedEnvironmentsCertificatesClientUpdateResponse, error) { + result := ConnectedEnvironmentsCertificatesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { + return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client_example_test.go new file mode 100644 index 000000000000..89386f024514 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client_example_test.go @@ -0,0 +1,223 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +func ExampleConnectedEnvironmentsCertificatesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewConnectedEnvironmentsCertificatesClient().NewListPager("examplerg", "testcontainerenv", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.CertificateCollection = armappcontainers.CertificateCollection{ + // Value: []*armappcontainers.Certificate{ + // { + // Name: to.Ptr("certificate-firendly-name"), + // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.CertificateProperties{ + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), + // Issuer: to.Ptr("Issuer Name"), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // }, + // { + // Name: to.Ptr("certificate-firendly-name"), + // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.CertificateProperties{ + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), + // Issuer: to.Ptr("Issuer Name"), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Get.json +func ExampleConnectedEnvironmentsCertificatesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsCertificatesClient().Get(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Certificate = armappcontainers.Certificate{ + // Name: to.Ptr("certificate-firendly-name"), + // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.CertificateProperties{ + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), + // Issuer: to.Ptr("Issuer Name"), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +func ExampleConnectedEnvironmentsCertificatesClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsCertificatesClient().CreateOrUpdate(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", &armappcontainers.ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions{CertificateEnvelope: &armappcontainers.Certificate{ + Location: to.Ptr("East US"), + Properties: &armappcontainers.CertificateProperties{ + Password: to.Ptr("private key password"), + Value: []byte("Y2VydA=="), + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Certificate = armappcontainers.Certificate{ + // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.CertificateProperties{ + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), + // Issuer: to.Ptr("Issuer Name"), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Delete.json +func ExampleConnectedEnvironmentsCertificatesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewConnectedEnvironmentsCertificatesClient().Delete(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_Patch.json +func ExampleConnectedEnvironmentsCertificatesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsCertificatesClient().Update(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", armappcontainers.CertificatePatch{ + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Certificate = armappcontainers.Certificate{ + // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // Properties: &armappcontainers.CertificateProperties{ + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00Z"); return t}()), + // Issuer: to.Ptr("Issuer Name"), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectAlternativeNames: []*string{ + // to.Ptr("CN=my-subject-name.com")}, + // SubjectName: to.Ptr("my-subject-name.company.country.net"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // Valid: to.Ptr(true), + // }, + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go new file mode 100644 index 000000000000..51216072f01c --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go @@ -0,0 +1,359 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ConnectedEnvironmentsDaprComponentsClient contains the methods for the ConnectedEnvironmentsDaprComponents group. +// Don't use this type directly, use NewConnectedEnvironmentsDaprComponentsClient() instead. +type ConnectedEnvironmentsDaprComponentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewConnectedEnvironmentsDaprComponentsClient creates a new instance of ConnectedEnvironmentsDaprComponentsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewConnectedEnvironmentsDaprComponentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsDaprComponentsClient, error) { + cl, err := arm.NewClient(moduleName+".ConnectedEnvironmentsDaprComponentsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ConnectedEnvironmentsDaprComponentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a Dapr Component in a connected environment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connected environment. +// - componentName - Name of the Dapr Component. +// - daprComponentEnvelope - Configuration details of the Dapr Component. +// - options - ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope DaprComponent, options *ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions) (ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, daprComponentEnvelope, options) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope DaprComponent, options *ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, daprComponentEnvelope) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse, error) { + result := ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponent); err != nil { + return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Dapr Component from a connected environment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connected environment. +// - componentName - Name of the Dapr Component. +// - options - ConnectedEnvironmentsDaprComponentsClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Delete +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientDeleteOptions) (ConnectedEnvironmentsDaprComponentsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, options) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectedEnvironmentsDaprComponentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a dapr component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connected environment. +// - componentName - Name of the Dapr Component. +// - options - ConnectedEnvironmentsDaprComponentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Get +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) Get(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientGetOptions) (ConnectedEnvironmentsDaprComponentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, options) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectedEnvironmentsDaprComponentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectedEnvironmentsDaprComponentsClient) getHandleResponse(resp *http.Response) (ConnectedEnvironmentsDaprComponentsClientGetResponse, error) { + result := ConnectedEnvironmentsDaprComponentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponent); err != nil { + return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Dapr Components for a connected environment. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connected environment. +// - options - ConnectedEnvironmentsDaprComponentsClientListOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.NewListPager +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) NewListPager(resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsDaprComponentsClientListOptions) *runtime.Pager[ConnectedEnvironmentsDaprComponentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectedEnvironmentsDaprComponentsClientListResponse]{ + More: func(page ConnectedEnvironmentsDaprComponentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectedEnvironmentsDaprComponentsClientListResponse) (ConnectedEnvironmentsDaprComponentsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsDaprComponentsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectedEnvironmentsDaprComponentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsDaprComponentsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConnectedEnvironmentsDaprComponentsClient) listHandleResponse(resp *http.Response) (ConnectedEnvironmentsDaprComponentsClientListResponse, error) { + result := ConnectedEnvironmentsDaprComponentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponentsCollection); err != nil { + return ConnectedEnvironmentsDaprComponentsClientListResponse{}, err + } + return result, nil +} + +// ListSecrets - List secrets for a dapr component +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the connected environment. +// - componentName - Name of the Dapr Component. +// - options - ConnectedEnvironmentsDaprComponentsClientListSecretsOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.ListSecrets +// method. +func (client *ConnectedEnvironmentsDaprComponentsClient) ListSecrets(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientListSecretsOptions) (ConnectedEnvironmentsDaprComponentsClientListSecretsResponse, error) { + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, options) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{}, runtime.NewResponseError(resp) + } + return client.listSecretsHandleResponse(resp) +} + +// listSecretsCreateRequest creates the ListSecrets request. +func (client *ConnectedEnvironmentsDaprComponentsClient) listSecretsCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecretsHandleResponse handles the ListSecrets response. +func (client *ConnectedEnvironmentsDaprComponentsClient) listSecretsHandleResponse(resp *http.Response) (ConnectedEnvironmentsDaprComponentsClientListSecretsResponse, error) { + result := ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprSecretsCollection); err != nil { + return ConnectedEnvironmentsDaprComponentsClientListSecretsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go new file mode 100644 index 000000000000..a973564ed261 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_List.json +func ExampleConnectedEnvironmentsDaprComponentsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewConnectedEnvironmentsDaprComponentsClient().NewListPager("examplerg", "myenvironment", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.DaprComponentsCollection = armappcontainers.DaprComponentsCollection{ + // Value: []*armappcontainers.DaprComponent{ + // { + // Name: to.Ptr("reddog"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments/daprcomponents"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/myenvironment/daprcomponents/reddog"), + // Properties: &armappcontainers.DaprComponentProperties{ + // ComponentType: to.Ptr("state.azure.cosmosdb"), + // IgnoreErrors: to.Ptr(false), + // InitTimeout: to.Ptr("50s"), + // Metadata: []*armappcontainers.DaprMetadata{ + // { + // Name: to.Ptr("url"), + // Value: to.Ptr(""), + // }, + // { + // Name: to.Ptr("database"), + // Value: to.Ptr("itemsDB"), + // }, + // { + // Name: to.Ptr("collection"), + // Value: to.Ptr("items"), + // }, + // { + // Name: to.Ptr("masterkey"), + // SecretRef: to.Ptr("masterkey"), + // }}, + // Scopes: []*string{ + // to.Ptr("container-app-1"), + // to.Ptr("container-app-2")}, + // Secrets: []*armappcontainers.Secret{ + // { + // Name: to.Ptr("masterkey"), + // }}, + // Version: to.Ptr("v1"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json +func ExampleConnectedEnvironmentsDaprComponentsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsDaprComponentsClient().Get(ctx, "examplerg", "myenvironment", "reddog", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DaprComponent = armappcontainers.DaprComponent{ + // Name: to.Ptr("reddog"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments/daprcomponents"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/jlaw-demo1/daprcomponents/reddog"), + // Properties: &armappcontainers.DaprComponentProperties{ + // ComponentType: to.Ptr("state.azure.cosmosdb"), + // IgnoreErrors: to.Ptr(false), + // InitTimeout: to.Ptr("50s"), + // Metadata: []*armappcontainers.DaprMetadata{ + // { + // Name: to.Ptr("url"), + // Value: to.Ptr(""), + // }, + // { + // Name: to.Ptr("database"), + // Value: to.Ptr("itemsDB"), + // }, + // { + // Name: to.Ptr("collection"), + // Value: to.Ptr("items"), + // }, + // { + // Name: to.Ptr("masterkey"), + // SecretRef: to.Ptr("masterkey"), + // }}, + // Scopes: []*string{ + // to.Ptr("container-app-1"), + // to.Ptr("container-app-2")}, + // Secrets: []*armappcontainers.Secret{ + // { + // Name: to.Ptr("masterkey"), + // }}, + // Version: to.Ptr("v1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +func ExampleConnectedEnvironmentsDaprComponentsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsDaprComponentsClient().CreateOrUpdate(ctx, "examplerg", "myenvironment", "reddog", armappcontainers.DaprComponent{ + Properties: &armappcontainers.DaprComponentProperties{ + ComponentType: to.Ptr("state.azure.cosmosdb"), + IgnoreErrors: to.Ptr(false), + InitTimeout: to.Ptr("50s"), + Metadata: []*armappcontainers.DaprMetadata{ + { + Name: to.Ptr("url"), + Value: to.Ptr(""), + }, + { + Name: to.Ptr("database"), + Value: to.Ptr("itemsDB"), + }, + { + Name: to.Ptr("collection"), + Value: to.Ptr("items"), + }, + { + Name: to.Ptr("masterkey"), + SecretRef: to.Ptr("masterkey"), + }}, + Scopes: []*string{ + to.Ptr("container-app-1"), + to.Ptr("container-app-2")}, + Secrets: []*armappcontainers.Secret{ + { + Name: to.Ptr("masterkey"), + Value: to.Ptr("keyvalue"), + }}, + Version: to.Ptr("v1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DaprComponent = armappcontainers.DaprComponent{ + // Name: to.Ptr("reddog"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments/daprcomponents"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/jlaw-demo1/daprcomponents/reddog"), + // Properties: &armappcontainers.DaprComponentProperties{ + // ComponentType: to.Ptr("state.azure.cosmosdb"), + // IgnoreErrors: to.Ptr(false), + // InitTimeout: to.Ptr("50s"), + // Metadata: []*armappcontainers.DaprMetadata{ + // { + // Name: to.Ptr("url"), + // Value: to.Ptr(""), + // }, + // { + // Name: to.Ptr("database"), + // Value: to.Ptr("itemsDB"), + // }, + // { + // Name: to.Ptr("collection"), + // Value: to.Ptr("items"), + // }, + // { + // Name: to.Ptr("masterkey"), + // SecretRef: to.Ptr("masterkey"), + // }}, + // Scopes: []*string{ + // to.Ptr("container-app-1"), + // to.Ptr("container-app-2")}, + // Secrets: []*armappcontainers.Secret{ + // { + // Name: to.Ptr("masterkey"), + // }}, + // Version: to.Ptr("v1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json +func ExampleConnectedEnvironmentsDaprComponentsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewConnectedEnvironmentsDaprComponentsClient().Delete(ctx, "examplerg", "myenvironment", "reddog", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +func ExampleConnectedEnvironmentsDaprComponentsClient_ListSecrets() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsDaprComponentsClient().ListSecrets(ctx, "examplerg", "myenvironment", "reddog", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DaprSecretsCollection = armappcontainers.DaprSecretsCollection{ + // Value: []*armappcontainers.DaprSecret{ + // { + // Name: to.Ptr("secret1"), + // Value: to.Ptr("value1"), + // }, + // { + // Name: to.Ptr("secret2"), + // Value: to.Ptr("value2"), + // }}, + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go new file mode 100644 index 000000000000..0b8e7a561869 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go @@ -0,0 +1,284 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ConnectedEnvironmentsStoragesClient contains the methods for the ConnectedEnvironmentsStorages group. +// Don't use this type directly, use NewConnectedEnvironmentsStoragesClient() instead. +type ConnectedEnvironmentsStoragesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewConnectedEnvironmentsStoragesClient creates a new instance of ConnectedEnvironmentsStoragesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewConnectedEnvironmentsStoragesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsStoragesClient, error) { + cl, err := arm.NewClient(moduleName+".ConnectedEnvironmentsStoragesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ConnectedEnvironmentsStoragesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update storage for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Environment. +// - storageName - Name of the storage. +// - storageEnvelope - Configuration details of storage. +// - options - ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.CreateOrUpdate +// method. +func (client *ConnectedEnvironmentsStoragesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope ConnectedEnvironmentStorage, options *ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions) (ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, storageName, storageEnvelope, options) + if err != nil { + return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope ConnectedEnvironmentStorage, options *ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, storageEnvelope) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse, error) { + result := ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentStorage); err != nil { + return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete storage for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Environment. +// - storageName - Name of the storage. +// - options - ConnectedEnvironmentsStoragesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Delete +// method. +func (client *ConnectedEnvironmentsStoragesClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientDeleteOptions) (ConnectedEnvironmentsStoragesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, storageName, options) + if err != nil { + return ConnectedEnvironmentsStoragesClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsStoragesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectedEnvironmentsStoragesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectedEnvironmentsStoragesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectedEnvironmentsStoragesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get storage for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Environment. +// - storageName - Name of the storage. +// - options - ConnectedEnvironmentsStoragesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Get +// method. +func (client *ConnectedEnvironmentsStoragesClient) Get(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientGetOptions) (ConnectedEnvironmentsStoragesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, storageName, options) + if err != nil { + return ConnectedEnvironmentsStoragesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsStoragesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsStoragesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectedEnvironmentsStoragesClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectedEnvironmentsStoragesClient) getHandleResponse(resp *http.Response) (ConnectedEnvironmentsStoragesClientGetResponse, error) { + result := ConnectedEnvironmentsStoragesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentStorage); err != nil { + return ConnectedEnvironmentsStoragesClientGetResponse{}, err + } + return result, nil +} + +// List - Get all storages for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectedEnvironmentName - Name of the Environment. +// - options - ConnectedEnvironmentsStoragesClientListOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.List +// method. +func (client *ConnectedEnvironmentsStoragesClient) List(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsStoragesClientListOptions) (ConnectedEnvironmentsStoragesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, options) + if err != nil { + return ConnectedEnvironmentsStoragesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectedEnvironmentsStoragesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectedEnvironmentsStoragesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ConnectedEnvironmentsStoragesClient) listCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsStoragesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectedEnvironmentName == "" { + return nil, errors.New("parameter connectedEnvironmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectedEnvironmentName}", url.PathEscape(connectedEnvironmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConnectedEnvironmentsStoragesClient) listHandleResponse(resp *http.Response) (ConnectedEnvironmentsStoragesClientListResponse, error) { + result := ConnectedEnvironmentsStoragesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentStoragesCollection); err != nil { + return ConnectedEnvironmentsStoragesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go new file mode 100644 index 000000000000..66210a9be7b2 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go @@ -0,0 +1,144 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_List.json +func ExampleConnectedEnvironmentsStoragesClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsStoragesClient().List(ctx, "examplerg", "managedEnv", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ConnectedEnvironmentStoragesCollection = armappcontainers.ConnectedEnvironmentStoragesCollection{ + // Value: []*armappcontainers.ConnectedEnvironmentStorage{ + // { + // Name: to.Ptr("jlaw-demo1"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments/storages"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/managedEnv/storages/jlaw-demo1"), + // Properties: &armappcontainers.ConnectedEnvironmentStorageProperties{ + // AzureFile: &armappcontainers.AzureFileProperties{ + // AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), + // AccountName: to.Ptr("account1"), + // ShareName: to.Ptr("share1"), + // }, + // }, + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Get.json +func ExampleConnectedEnvironmentsStoragesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsStoragesClient().Get(ctx, "examplerg", "env", "jlaw-demo1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ConnectedEnvironmentStorage = armappcontainers.ConnectedEnvironmentStorage{ + // Name: to.Ptr("jlaw-demo1"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments/storages"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/env/storages/jlaw-demo1"), + // Properties: &armappcontainers.ConnectedEnvironmentStorageProperties{ + // AzureFile: &armappcontainers.AzureFileProperties{ + // AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), + // AccountName: to.Ptr("account1"), + // ShareName: to.Ptr("share1"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +func ExampleConnectedEnvironmentsStoragesClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewConnectedEnvironmentsStoragesClient().CreateOrUpdate(ctx, "examplerg", "env", "jlaw-demo1", armappcontainers.ConnectedEnvironmentStorage{ + Properties: &armappcontainers.ConnectedEnvironmentStorageProperties{ + AzureFile: &armappcontainers.AzureFileProperties{ + AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), + AccountKey: to.Ptr("key"), + AccountName: to.Ptr("account1"), + ShareName: to.Ptr("share1"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ConnectedEnvironmentStorage = armappcontainers.ConnectedEnvironmentStorage{ + // Name: to.Ptr("jlaw-demo1"), + // Type: to.Ptr("Microsoft.App/connectedEnvironments/storages"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/env/storages/jlaw-demo1"), + // Properties: &armappcontainers.ConnectedEnvironmentStorageProperties{ + // AzureFile: &armappcontainers.AzureFileProperties{ + // AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), + // AccountName: to.Ptr("account1"), + // ShareName: to.Ptr("share1"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Delete.json +func ExampleConnectedEnvironmentsStoragesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewConnectedEnvironmentsStoragesClient().Delete(ctx, "examplerg", "env", "jlaw-demo1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/constants.go b/sdk/resourcemanager/appcontainers/armappcontainers/constants.go index fa54cf132557..b2d81edaaf99 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/constants.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/constants.go @@ -11,7 +11,7 @@ package armappcontainers const ( moduleName = "armappcontainers" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0-beta.3" ) // AccessMode - Access mode for storage @@ -30,6 +30,22 @@ func PossibleAccessModeValues() []AccessMode { } } +// Action - Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of ALL Allow or ALL Deny +type Action string + +const ( + ActionAllow Action = "Allow" + ActionDeny Action = "Deny" +) + +// PossibleActionValues returns the possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{ + ActionAllow, + ActionDeny, + } +} + // ActiveRevisionsMode - ActiveRevisionsMode controls how active revisions are handled for the Container app:Multiple: multiple // revisions can be active.Single: Only one revision can be active at a time. Revision weights can // not be used in this mode. If no value if provided, this is the default. @@ -48,6 +64,22 @@ func PossibleActiveRevisionsModeValues() []ActiveRevisionsMode { } } +// Affinity - Sticky Session Affinity +type Affinity string + +const ( + AffinityNone Affinity = "none" + AffinitySticky Affinity = "sticky" +) + +// PossibleAffinityValues returns the possible values for the Affinity const type. +func PossibleAffinityValues() []Affinity { + return []Affinity{ + AffinityNone, + AffinitySticky, + } +} + // AppProtocol - Tells Dapr which protocol your application is using. Valid options are http and grpc. Default is http type AppProtocol string @@ -64,6 +96,22 @@ func PossibleAppProtocolValues() []AppProtocol { } } +// Applicability - indicates whether the profile is default for the location. +type Applicability string + +const ( + ApplicabilityCustom Applicability = "Custom" + ApplicabilityLocationDefault Applicability = "LocationDefault" +) + +// PossibleApplicabilityValues returns the possible values for the Applicability const type. +func PossibleApplicabilityValues() []Applicability { + return []Applicability{ + ApplicabilityCustom, + ApplicabilityLocationDefault, + } +} + // BindingType - Custom Domain binding type. type BindingType string @@ -118,11 +166,40 @@ func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { } } +// ConnectedEnvironmentProvisioningState - Provisioning state of the Kubernetes Environment. +type ConnectedEnvironmentProvisioningState string + +const ( + ConnectedEnvironmentProvisioningStateCanceled ConnectedEnvironmentProvisioningState = "Canceled" + ConnectedEnvironmentProvisioningStateFailed ConnectedEnvironmentProvisioningState = "Failed" + ConnectedEnvironmentProvisioningStateInfrastructureSetupComplete ConnectedEnvironmentProvisioningState = "InfrastructureSetupComplete" + ConnectedEnvironmentProvisioningStateInfrastructureSetupInProgress ConnectedEnvironmentProvisioningState = "InfrastructureSetupInProgress" + ConnectedEnvironmentProvisioningStateInitializationInProgress ConnectedEnvironmentProvisioningState = "InitializationInProgress" + ConnectedEnvironmentProvisioningStateScheduledForDelete ConnectedEnvironmentProvisioningState = "ScheduledForDelete" + ConnectedEnvironmentProvisioningStateSucceeded ConnectedEnvironmentProvisioningState = "Succeeded" + ConnectedEnvironmentProvisioningStateWaiting ConnectedEnvironmentProvisioningState = "Waiting" +) + +// PossibleConnectedEnvironmentProvisioningStateValues returns the possible values for the ConnectedEnvironmentProvisioningState const type. +func PossibleConnectedEnvironmentProvisioningStateValues() []ConnectedEnvironmentProvisioningState { + return []ConnectedEnvironmentProvisioningState{ + ConnectedEnvironmentProvisioningStateCanceled, + ConnectedEnvironmentProvisioningStateFailed, + ConnectedEnvironmentProvisioningStateInfrastructureSetupComplete, + ConnectedEnvironmentProvisioningStateInfrastructureSetupInProgress, + ConnectedEnvironmentProvisioningStateInitializationInProgress, + ConnectedEnvironmentProvisioningStateScheduledForDelete, + ConnectedEnvironmentProvisioningStateSucceeded, + ConnectedEnvironmentProvisioningStateWaiting, + } +} + // ContainerAppProvisioningState - Provisioning state of the Container App. type ContainerAppProvisioningState string const ( ContainerAppProvisioningStateCanceled ContainerAppProvisioningState = "Canceled" + ContainerAppProvisioningStateDeleting ContainerAppProvisioningState = "Deleting" ContainerAppProvisioningStateFailed ContainerAppProvisioningState = "Failed" ContainerAppProvisioningStateInProgress ContainerAppProvisioningState = "InProgress" ContainerAppProvisioningStateSucceeded ContainerAppProvisioningState = "Succeeded" @@ -132,6 +209,7 @@ const ( func PossibleContainerAppProvisioningStateValues() []ContainerAppProvisioningState { return []ContainerAppProvisioningState{ ContainerAppProvisioningStateCanceled, + ContainerAppProvisioningStateDeleting, ContainerAppProvisioningStateFailed, ContainerAppProvisioningStateInProgress, ContainerAppProvisioningStateSucceeded, @@ -224,6 +302,20 @@ func PossibleEnvironmentProvisioningStateValues() []EnvironmentProvisioningState } } +// ExtendedLocationTypes - The type of extendedLocation. +type ExtendedLocationTypes string + +const ( + ExtendedLocationTypesCustomLocation ExtendedLocationTypes = "CustomLocation" +) + +// PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ + ExtendedLocationTypesCustomLocation, + } +} + // ForwardProxyConvention - The convention used to determine the url of the request made. type ForwardProxyConvention string @@ -242,6 +334,26 @@ func PossibleForwardProxyConventionValues() []ForwardProxyConvention { } } +// IngressClientCertificateMode - Client certificate mode for mTLS authentication. Ignore indicates server drops client certificate +// on forwarding. Accept indicates server forwards client certificate but does not require a client +// certificate. Require indicates server requires a client certificate. +type IngressClientCertificateMode string + +const ( + IngressClientCertificateModeAccept IngressClientCertificateMode = "accept" + IngressClientCertificateModeIgnore IngressClientCertificateMode = "ignore" + IngressClientCertificateModeRequire IngressClientCertificateMode = "require" +) + +// PossibleIngressClientCertificateModeValues returns the possible values for the IngressClientCertificateMode const type. +func PossibleIngressClientCertificateModeValues() []IngressClientCertificateMode { + return []IngressClientCertificateMode{ + IngressClientCertificateModeAccept, + IngressClientCertificateModeIgnore, + IngressClientCertificateModeRequire, + } +} + // IngressTransportMethod - Ingress transport protocol type IngressTransportMethod string @@ -249,6 +361,7 @@ const ( IngressTransportMethodAuto IngressTransportMethod = "auto" IngressTransportMethodHTTP IngressTransportMethod = "http" IngressTransportMethodHTTP2 IngressTransportMethod = "http2" + IngressTransportMethodTCP IngressTransportMethod = "tcp" ) // PossibleIngressTransportMethodValues returns the possible values for the IngressTransportMethod const type. @@ -257,6 +370,93 @@ func PossibleIngressTransportMethodValues() []IngressTransportMethod { IngressTransportMethodAuto, IngressTransportMethodHTTP, IngressTransportMethodHTTP2, + IngressTransportMethodTCP, + } +} + +// JobExecutionRunningState - Current running State of the job +type JobExecutionRunningState string + +const ( + JobExecutionRunningStateDegraded JobExecutionRunningState = "Degraded" + JobExecutionRunningStateFailed JobExecutionRunningState = "Failed" + JobExecutionRunningStateProcessing JobExecutionRunningState = "Processing" + JobExecutionRunningStateRunning JobExecutionRunningState = "Running" + JobExecutionRunningStateStopped JobExecutionRunningState = "Stopped" + JobExecutionRunningStateSucceeded JobExecutionRunningState = "Succeeded" + JobExecutionRunningStateUnknown JobExecutionRunningState = "Unknown" +) + +// PossibleJobExecutionRunningStateValues returns the possible values for the JobExecutionRunningState const type. +func PossibleJobExecutionRunningStateValues() []JobExecutionRunningState { + return []JobExecutionRunningState{ + JobExecutionRunningStateDegraded, + JobExecutionRunningStateFailed, + JobExecutionRunningStateProcessing, + JobExecutionRunningStateRunning, + JobExecutionRunningStateStopped, + JobExecutionRunningStateSucceeded, + JobExecutionRunningStateUnknown, + } +} + +// JobProvisioningState - Provisioning state of the Container Apps Job. +type JobProvisioningState string + +const ( + JobProvisioningStateCanceled JobProvisioningState = "Canceled" + JobProvisioningStateDeleting JobProvisioningState = "Deleting" + JobProvisioningStateFailed JobProvisioningState = "Failed" + JobProvisioningStateInProgress JobProvisioningState = "InProgress" + JobProvisioningStateSucceeded JobProvisioningState = "Succeeded" +) + +// PossibleJobProvisioningStateValues returns the possible values for the JobProvisioningState const type. +func PossibleJobProvisioningStateValues() []JobProvisioningState { + return []JobProvisioningState{ + JobProvisioningStateCanceled, + JobProvisioningStateDeleting, + JobProvisioningStateFailed, + JobProvisioningStateInProgress, + JobProvisioningStateSucceeded, + } +} + +// LogLevel - Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. +type LogLevel string + +const ( + LogLevelDebug LogLevel = "debug" + LogLevelError LogLevel = "error" + LogLevelInfo LogLevel = "info" + LogLevelWarn LogLevel = "warn" +) + +// PossibleLogLevelValues returns the possible values for the LogLevel const type. +func PossibleLogLevelValues() []LogLevel { + return []LogLevel{ + LogLevelDebug, + LogLevelError, + LogLevelInfo, + LogLevelWarn, + } +} + +// ManagedCertificateDomainControlValidation - Selected type of domain control validation for managed certificates. +type ManagedCertificateDomainControlValidation string + +const ( + ManagedCertificateDomainControlValidationCNAME ManagedCertificateDomainControlValidation = "CNAME" + ManagedCertificateDomainControlValidationHTTP ManagedCertificateDomainControlValidation = "HTTP" + ManagedCertificateDomainControlValidationTXT ManagedCertificateDomainControlValidation = "TXT" +) + +// PossibleManagedCertificateDomainControlValidationValues returns the possible values for the ManagedCertificateDomainControlValidation const type. +func PossibleManagedCertificateDomainControlValidationValues() []ManagedCertificateDomainControlValidation { + return []ManagedCertificateDomainControlValidation{ + ManagedCertificateDomainControlValidationCNAME, + ManagedCertificateDomainControlValidationHTTP, + ManagedCertificateDomainControlValidationTXT, } } @@ -362,6 +562,7 @@ type StorageType string const ( StorageTypeAzureFile StorageType = "AzureFile" StorageTypeEmptyDir StorageType = "EmptyDir" + StorageTypeSecret StorageType = "Secret" ) // PossibleStorageTypeValues returns the possible values for the StorageType const type. @@ -369,6 +570,25 @@ func PossibleStorageTypeValues() []StorageType { return []StorageType{ StorageTypeAzureFile, StorageTypeEmptyDir, + StorageTypeSecret, + } +} + +// TriggerType - Trigger type of the job +type TriggerType string + +const ( + TriggerTypeEvent TriggerType = "Event" + TriggerTypeManual TriggerType = "Manual" + TriggerTypeScheduled TriggerType = "Scheduled" +) + +// PossibleTriggerTypeValues returns the possible values for the TriggerType const type. +func PossibleTriggerTypeValues() []TriggerType { + return []TriggerType{ + TriggerTypeEvent, + TriggerTypeManual, + TriggerTypeScheduled, } } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go index 60a06d461f17..e2387001b917 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go @@ -47,7 +47,7 @@ func NewContainerAppsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create or update a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - containerAppEnvelope - Properties used to create a container app @@ -59,7 +59,9 @@ func (client *ContainerAppsClient) BeginCreateOrUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[ContainerAppsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ContainerAppsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,7 +70,7 @@ func (client *ContainerAppsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview func (client *ContainerAppsClient) createOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, containerAppName, containerAppEnvelope, options) if err != nil { @@ -104,7 +106,7 @@ func (client *ContainerAppsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, containerAppEnvelope) @@ -113,7 +115,7 @@ func (client *ContainerAppsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - options - ContainerAppsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsClient.BeginDelete @@ -124,7 +126,9 @@ func (client *ContainerAppsClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[ContainerAppsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ContainerAppsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -133,7 +137,7 @@ func (client *ContainerAppsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview func (client *ContainerAppsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, containerAppName, options) if err != nil { @@ -169,7 +173,7 @@ func (client *ContainerAppsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,7 +182,7 @@ func (client *ContainerAppsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get the properties of a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - options - ContainerAppsClientGetOptions contains the optional parameters for the ContainerAppsClient.Get method. @@ -217,7 +221,7 @@ func (client *ContainerAppsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,9 +236,67 @@ func (client *ContainerAppsClient) getHandleResponse(resp *http.Response) (Conta return result, nil } +// GetAuthToken - Get auth token for a container app +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - containerAppName - Name of the Container App. +// - options - ContainerAppsClientGetAuthTokenOptions contains the optional parameters for the ContainerAppsClient.GetAuthToken +// method. +func (client *ContainerAppsClient) GetAuthToken(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientGetAuthTokenOptions) (ContainerAppsClientGetAuthTokenResponse, error) { + req, err := client.getAuthTokenCreateRequest(ctx, resourceGroupName, containerAppName, options) + if err != nil { + return ContainerAppsClientGetAuthTokenResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsClientGetAuthTokenResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsClientGetAuthTokenResponse{}, runtime.NewResponseError(resp) + } + return client.getAuthTokenHandleResponse(resp) +} + +// getAuthTokenCreateRequest creates the GetAuthToken request. +func (client *ContainerAppsClient) getAuthTokenCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientGetAuthTokenOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAuthTokenHandleResponse handles the GetAuthToken response. +func (client *ContainerAppsClient) getAuthTokenHandleResponse(resp *http.Response) (ContainerAppsClientGetAuthTokenResponse, error) { + result := ContainerAppsClientGetAuthTokenResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerAppAuthToken); err != nil { + return ContainerAppsClientGetAuthTokenResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - Get the Container Apps in a given resource group. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ContainerAppsClientListByResourceGroupOptions contains the optional parameters for the ContainerAppsClient.NewListByResourceGroupPager // method. @@ -282,7 +344,7 @@ func (client *ContainerAppsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,7 +361,7 @@ func (client *ContainerAppsClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - Get the Container Apps in a given subscription. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - options - ContainerAppsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsClient.NewListBySubscriptionPager // method. func (client *ContainerAppsClient) NewListBySubscriptionPager(options *ContainerAppsClientListBySubscriptionOptions) *runtime.Pager[ContainerAppsClientListBySubscriptionResponse] { @@ -342,7 +404,7 @@ func (client *ContainerAppsClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -360,7 +422,7 @@ func (client *ContainerAppsClient) listBySubscriptionHandleResponse(resp *http.R // ListCustomHostNameAnalysis - Analyzes a custom hostname for a Container App // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - options - ContainerAppsClientListCustomHostNameAnalysisOptions contains the optional parameters for the ContainerAppsClient.ListCustomHostNameAnalysis @@ -403,7 +465,7 @@ func (client *ContainerAppsClient) listCustomHostNameAnalysisCreateRequest(ctx c if options != nil && options.CustomHostname != nil { reqQP.Set("customHostname", *options.CustomHostname) } - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -421,7 +483,7 @@ func (client *ContainerAppsClient) listCustomHostNameAnalysisHandleResponse(resp // ListSecrets - List secrets for a container app // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - options - ContainerAppsClientListSecretsOptions contains the optional parameters for the ContainerAppsClient.ListSecrets @@ -461,7 +523,7 @@ func (client *ContainerAppsClient) listSecretsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -479,7 +541,7 @@ func (client *ContainerAppsClient) listSecretsHandleResponse(resp *http.Response // BeginUpdate - Patches a Container App using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - containerAppEnvelope - Properties of a Container App that need to be updated @@ -500,7 +562,7 @@ func (client *ContainerAppsClient) BeginUpdate(ctx context.Context, resourceGrou // Update - Patches a Container App using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview func (client *ContainerAppsClient) update(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, containerAppName, containerAppEnvelope, options) if err != nil { @@ -510,7 +572,7 @@ func (client *ContainerAppsClient) update(ctx context.Context, resourceGroupName if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil @@ -536,7 +598,7 @@ func (client *ContainerAppsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, containerAppEnvelope) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go index 6f13420e1bc1..a7375a42ab8a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListBySubscription.json func ExampleContainerAppsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,7 +52,11 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // Dapr: &armappcontainers.Dapr{ // AppPort: to.Ptr[int32](3000), // AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), + // EnableAPILogging: to.Ptr(true), // Enabled: to.Ptr(true), + // HTTPMaxRequestSize: to.Ptr[int32](10), + // HTTPReadBufferSize: to.Ptr[int32](30), + // LogLevel: to.Ptr(armappcontainers.LogLevelDebug), // }, // Ingress: &armappcontainers.Ingress{ // CustomDomains: []*armappcontainers.CustomDomain{ @@ -68,6 +72,22 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // }}, // External: to.Ptr(true), // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ + // { + // Name: to.Ptr("Allow work IP A subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/32"), + // }, + // { + // Name: to.Ptr("Allow work IP B subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/8"), + // }}, + // StickySessions: &armappcontainers.IngressStickySessions{ + // Affinity: to.Ptr(armappcontainers.AffinitySticky), + // }, // TargetPort: to.Ptr[int32](3000), // Traffic: []*armappcontainers.TrafficWeight{ // { @@ -81,7 +101,10 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // }}, // Transport: to.Ptr(armappcontainers.IngressTransportMethodAuto), // }, + // MaxInactiveRevisions: to.Ptr[int32](10), // }, + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // LatestReadyRevisionName: to.Ptr("testcontainerApp0-pjxhsye"), // LatestRevisionFqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), @@ -95,6 +118,15 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // Memory: to.Ptr("100Mi"), // }, // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, // Scale: &armappcontainers.Scale{ // MaxReplicas: to.Ptr[int32](5), // MinReplicas: to.Ptr[int32](1), @@ -109,13 +141,14 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // }}, // }, // }, + // WorkloadProfileName: to.Ptr("My-GP-01"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListByResourceGroup.json func ExampleContainerAppsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -149,7 +182,11 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // Dapr: &armappcontainers.Dapr{ // AppPort: to.Ptr[int32](3000), // AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), + // EnableAPILogging: to.Ptr(true), // Enabled: to.Ptr(true), + // HTTPMaxRequestSize: to.Ptr[int32](10), + // HTTPReadBufferSize: to.Ptr[int32](30), + // LogLevel: to.Ptr(armappcontainers.LogLevelDebug), // }, // Ingress: &armappcontainers.Ingress{ // CustomDomains: []*armappcontainers.CustomDomain{ @@ -165,6 +202,22 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // }}, // External: to.Ptr(true), // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ + // { + // Name: to.Ptr("Allow work IP A subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/32"), + // }, + // { + // Name: to.Ptr("Allow work IP B subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/8"), + // }}, + // StickySessions: &armappcontainers.IngressStickySessions{ + // Affinity: to.Ptr(armappcontainers.AffinitySticky), + // }, // TargetPort: to.Ptr[int32](3000), // Traffic: []*armappcontainers.TrafficWeight{ // { @@ -178,7 +231,10 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // }}, // Transport: to.Ptr(armappcontainers.IngressTransportMethodAuto), // }, + // MaxInactiveRevisions: to.Ptr[int32](10), // }, + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // LatestReadyRevisionName: to.Ptr("testcontainerApp0-pjxhsye"), // LatestRevisionFqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), @@ -192,6 +248,15 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // Memory: to.Ptr("100Mi"), // }, // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, // Scale: &armappcontainers.Scale{ // MaxReplicas: to.Ptr[int32](5), // MinReplicas: to.Ptr[int32](1), @@ -206,13 +271,14 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // }}, // }, // }, + // WorkloadProfileName: to.Ptr("My-GP-01"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json func ExampleContainerAppsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -240,7 +306,11 @@ func ExampleContainerAppsClient_Get() { // Dapr: &armappcontainers.Dapr{ // AppPort: to.Ptr[int32](3000), // AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), + // EnableAPILogging: to.Ptr(true), // Enabled: to.Ptr(true), + // HTTPMaxRequestSize: to.Ptr[int32](10), + // HTTPReadBufferSize: to.Ptr[int32](30), + // LogLevel: to.Ptr(armappcontainers.LogLevelDebug), // }, // Ingress: &armappcontainers.Ingress{ // CustomDomains: []*armappcontainers.CustomDomain{ @@ -256,6 +326,22 @@ func ExampleContainerAppsClient_Get() { // }}, // External: to.Ptr(true), // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ + // { + // Name: to.Ptr("Allow work IP A subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/32"), + // }, + // { + // Name: to.Ptr("Allow work IP B subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/8"), + // }}, + // StickySessions: &armappcontainers.IngressStickySessions{ + // Affinity: to.Ptr(armappcontainers.AffinitySticky), + // }, // TargetPort: to.Ptr[int32](3000), // Traffic: []*armappcontainers.TrafficWeight{ // { @@ -269,7 +355,10 @@ func ExampleContainerAppsClient_Get() { // }}, // Transport: to.Ptr(armappcontainers.IngressTransportMethodAuto), // }, + // MaxInactiveRevisions: to.Ptr[int32](10), // }, + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // LatestReadyRevisionName: to.Ptr("testcontainerApp0-pjxhsye"), // LatestRevisionFqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), @@ -283,6 +372,15 @@ func ExampleContainerAppsClient_Get() { // Memory: to.Ptr("100Mi"), // }, // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, // Scale: &armappcontainers.Scale{ // MaxReplicas: to.Ptr[int32](5), // MinReplicas: to.Ptr[int32](1), @@ -297,12 +395,13 @@ func ExampleContainerAppsClient_Get() { // }}, // }, // }, + // WorkloadProfileName: to.Ptr("My-GP-01"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_CreateOrUpdate.json -func ExampleContainerAppsClient_BeginCreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CreateOrUpdate.json +func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -317,11 +416,32 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { Properties: &armappcontainers.ContainerAppProperties{ Configuration: &armappcontainers.Configuration{ Dapr: &armappcontainers.Dapr{ - AppPort: to.Ptr[int32](3000), - AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), - Enabled: to.Ptr(true), + AppPort: to.Ptr[int32](3000), + AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), + EnableAPILogging: to.Ptr(true), + Enabled: to.Ptr(true), + HTTPMaxRequestSize: to.Ptr[int32](10), + HTTPReadBufferSize: to.Ptr[int32](30), + LogLevel: to.Ptr(armappcontainers.LogLevelDebug), }, Ingress: &armappcontainers.Ingress{ + ClientCertificateMode: to.Ptr(armappcontainers.IngressClientCertificateModeAccept), + CorsPolicy: &armappcontainers.CorsPolicy{ + AllowCredentials: to.Ptr(true), + AllowedHeaders: []*string{ + to.Ptr("HEADER1"), + to.Ptr("HEADER2")}, + AllowedMethods: []*string{ + to.Ptr("GET"), + to.Ptr("POST")}, + AllowedOrigins: []*string{ + to.Ptr("https://a.test.com"), + to.Ptr("https://b.test.com")}, + ExposeHeaders: []*string{ + to.Ptr("HEADER3"), + to.Ptr("HEADER4")}, + MaxAge: to.Ptr[int32](1234), + }, CustomDomains: []*armappcontainers.CustomDomain{ { Name: to.Ptr("www.my-name.com"), @@ -333,7 +453,23 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { BindingType: to.Ptr(armappcontainers.BindingTypeSniEnabled), CertificateID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com"), }}, - External: to.Ptr(true), + External: to.Ptr(true), + IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ + { + Name: to.Ptr("Allow work IP A subnet"), + Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + Action: to.Ptr(armappcontainers.ActionAllow), + IPAddressRange: to.Ptr("192.168.1.1/32"), + }, + { + Name: to.Ptr("Allow work IP B subnet"), + Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + Action: to.Ptr(armappcontainers.ActionAllow), + IPAddressRange: to.Ptr("192.168.1.1/8"), + }}, + StickySessions: &armappcontainers.IngressStickySessions{ + Affinity: to.Ptr(armappcontainers.AffinitySticky), + }, TargetPort: to.Ptr[int32](3000), Traffic: []*armappcontainers.TrafficWeight{ { @@ -342,8 +478,9 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { Weight: to.Ptr[int32](100), }}, }, + MaxInactiveRevisions: to.Ptr[int32](10), }, - ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), Template: &armappcontainers.Template{ Containers: []*armappcontainers.Container{ { @@ -365,6 +502,20 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { PeriodSeconds: to.Ptr[int32](3), }}, }}, + InitContainers: []*armappcontainers.InitContainer{ + { + Name: to.Ptr("testinitcontainerApp0"), + Args: []*string{ + to.Ptr("-c"), + to.Ptr("while true; do echo hello; sleep 10;done")}, + Command: []*string{ + to.Ptr("/bin/sh")}, + Image: to.Ptr("repo/testcontainerApp0:v4"), + Resources: &armappcontainers.ContainerResources{ + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), + }, + }}, Scale: &armappcontainers.Scale{ MaxReplicas: to.Ptr[int32](5), MinReplicas: to.Ptr[int32](1), @@ -380,6 +531,7 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { }}, }, }, + WorkloadProfileName: to.Ptr("My-GP-01"), }, }, nil) if err != nil { @@ -403,6 +555,7 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { // AppPort: to.Ptr[int32](3000), // AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), // Enabled: to.Ptr(true), + // HTTPReadBufferSize: to.Ptr[int32](30), // }, // Ingress: &armappcontainers.Ingress{ // CustomDomains: []*armappcontainers.CustomDomain{ @@ -418,6 +571,22 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { // }}, // External: to.Ptr(true), // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ + // { + // Name: to.Ptr("Allow work IP A subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/32"), + // }, + // { + // Name: to.Ptr("Allow work IP B subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/8"), + // }}, + // StickySessions: &armappcontainers.IngressStickySessions{ + // Affinity: to.Ptr(armappcontainers.AffinitySticky), + // }, // TargetPort: to.Ptr[int32](3000), // Traffic: []*armappcontainers.TrafficWeight{ // { @@ -432,6 +601,8 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { // Transport: to.Ptr(armappcontainers.IngressTransportMethodAuto), // }, // }, + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // LatestReadyRevisionName: to.Ptr("testcontainerApp0-pjxhsye"), // LatestRevisionFqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), @@ -440,6 +611,10 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { // { // Name: to.Ptr("testcontainerApp0"), // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, // Probes: []*armappcontainers.ContainerAppProbe{ // { // Type: to.Ptr(armappcontainers.TypeLiveness), @@ -455,20 +630,167 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { // InitialDelaySeconds: to.Ptr[int32](3), // PeriodSeconds: to.Ptr[int32](3), // }}, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerApp0"), + // Args: []*string{ + // to.Ptr("-c"), + // to.Ptr("while true; do echo hello; sleep 10;done")}, + // Command: []*string{ + // to.Ptr("/bin/sh")}, + // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // Scale: &armappcontainers.Scale{ + // MaxReplicas: to.Ptr[int32](5), + // MinReplicas: to.Ptr[int32](1), + // Rules: []*armappcontainers.ScaleRule{ + // { + // Name: to.Ptr("httpscalingrule"), + // HTTP: &armappcontainers.HTTPScaleRule{ + // Metadata: map[string]*string{ + // "concurrentRequests": to.Ptr("50"), + // }, + // }, + // }}, + // }, + // }, + // WorkloadProfileName: to.Ptr("My-GP-01"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateManagedByApp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewContainerAppsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerAppManagedBy", armappcontainers.ContainerApp{ + Location: to.Ptr("East US"), + ManagedBy: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp"), + Properties: &armappcontainers.ContainerAppProperties{ + Configuration: &armappcontainers.Configuration{ + Ingress: &armappcontainers.Ingress{ + ExposedPort: to.Ptr[int32](4000), + External: to.Ptr(true), + TargetPort: to.Ptr[int32](3000), + Traffic: []*armappcontainers.TrafficWeight{ + { + RevisionName: to.Ptr("testcontainerAppManagedBy-ab1234"), + Weight: to.Ptr[int32](100), + }}, + Transport: to.Ptr(armappcontainers.IngressTransportMethodTCP), + }, + }, + EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + Template: &armappcontainers.Template{ + Containers: []*armappcontainers.Container{ + { + Name: to.Ptr("testcontainerAppManagedBy"), + Image: to.Ptr("repo/testcontainerAppManagedBy:v1"), + Probes: []*armappcontainers.ContainerAppProbe{ + { + Type: to.Ptr(armappcontainers.TypeLiveness), + InitialDelaySeconds: to.Ptr[int32](3), + PeriodSeconds: to.Ptr[int32](3), + TCPSocket: &armappcontainers.ContainerAppProbeTCPSocket{ + Port: to.Ptr[int32](8080), + }, + }}, + }}, + Scale: &armappcontainers.Scale{ + MaxReplicas: to.Ptr[int32](5), + MinReplicas: to.Ptr[int32](1), + Rules: []*armappcontainers.ScaleRule{ + { + Name: to.Ptr("tcpscalingrule"), + TCP: &armappcontainers.TCPScaleRule{ + Metadata: map[string]*string{ + "concurrentConnections": to.Ptr("50"), + }, + }, + }}, + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContainerApp = armappcontainers.ContainerApp{ + // Name: to.Ptr("testcontainerAppManagedBy"), + // Type: to.Ptr("Microsoft.App/containerApps"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerAppManagedBy"), + // Location: to.Ptr("East US"), + // ManagedBy: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp"), + // Properties: &armappcontainers.ContainerAppProperties{ + // Configuration: &armappcontainers.Configuration{ + // Ingress: &armappcontainers.Ingress{ + // ExposedPort: to.Ptr[int32](4000), + // External: to.Ptr(true), + // Fqdn: to.Ptr("testcontainerAppManagedBy.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // TargetPort: to.Ptr[int32](3000), + // Traffic: []*armappcontainers.TrafficWeight{ + // { + // RevisionName: to.Ptr("testcontainerAppManagedBy-ab1234"), + // Weight: to.Ptr[int32](80), + // }, + // { + // RevisionName: to.Ptr("testcontainerAppManagedBy-ab4321"), + // Weight: to.Ptr[int32](20), + // }}, + // Transport: to.Ptr(armappcontainers.IngressTransportMethodTCP), + // }, + // }, + // LatestReadyRevisionName: to.Ptr("testcontainerAppManagedBy-pjxhsye"), + // LatestRevisionFqdn: to.Ptr("testcontainerAppManagedBy-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), + // Template: &armappcontainers.Template{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerAppManagedBy"), + // Image: to.Ptr("repo/testcontainerAppManagedBy:v4"), // Resources: &armappcontainers.ContainerResources{ // CPU: to.Ptr[float64](0.2), // Memory: to.Ptr("100Mi"), // }, + // Probes: []*armappcontainers.ContainerAppProbe{ + // { + // Type: to.Ptr(armappcontainers.TypeLiveness), + // InitialDelaySeconds: to.Ptr[int32](3), + // PeriodSeconds: to.Ptr[int32](3), + // TCPSocket: &armappcontainers.ContainerAppProbeTCPSocket{ + // Port: to.Ptr[int32](8080), + // }, + // }}, // }}, // Scale: &armappcontainers.Scale{ // MaxReplicas: to.Ptr[int32](5), // MinReplicas: to.Ptr[int32](1), // Rules: []*armappcontainers.ScaleRule{ // { - // Name: to.Ptr("httpscalingrule"), - // HTTP: &armappcontainers.HTTPScaleRule{ + // Name: to.Ptr("tcpscalingrule"), + // TCP: &armappcontainers.TCPScaleRule{ // Metadata: map[string]*string{ - // "concurrentRequests": to.Ptr("50"), + // "concurrentConnections": to.Ptr("50"), // }, // }, // }}, @@ -478,7 +800,141 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json +func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateTcpApp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewContainerAppsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerAppTcp", armappcontainers.ContainerApp{ + Location: to.Ptr("East US"), + Properties: &armappcontainers.ContainerAppProperties{ + Configuration: &armappcontainers.Configuration{ + Ingress: &armappcontainers.Ingress{ + ExposedPort: to.Ptr[int32](4000), + External: to.Ptr(true), + TargetPort: to.Ptr[int32](3000), + Traffic: []*armappcontainers.TrafficWeight{ + { + RevisionName: to.Ptr("testcontainerAppTcp-ab1234"), + Weight: to.Ptr[int32](100), + }}, + Transport: to.Ptr(armappcontainers.IngressTransportMethodTCP), + }, + }, + EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + Template: &armappcontainers.Template{ + Containers: []*armappcontainers.Container{ + { + Name: to.Ptr("testcontainerAppTcp"), + Image: to.Ptr("repo/testcontainerAppTcp:v1"), + Probes: []*armappcontainers.ContainerAppProbe{ + { + Type: to.Ptr(armappcontainers.TypeLiveness), + InitialDelaySeconds: to.Ptr[int32](3), + PeriodSeconds: to.Ptr[int32](3), + TCPSocket: &armappcontainers.ContainerAppProbeTCPSocket{ + Port: to.Ptr[int32](8080), + }, + }}, + }}, + Scale: &armappcontainers.Scale{ + MaxReplicas: to.Ptr[int32](5), + MinReplicas: to.Ptr[int32](1), + Rules: []*armappcontainers.ScaleRule{ + { + Name: to.Ptr("tcpscalingrule"), + TCP: &armappcontainers.TCPScaleRule{ + Metadata: map[string]*string{ + "concurrentConnections": to.Ptr("50"), + }, + }, + }}, + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContainerApp = armappcontainers.ContainerApp{ + // Name: to.Ptr("testcontainerAppTcp"), + // Type: to.Ptr("Microsoft.App/containerApps"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerAppTcp"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ContainerAppProperties{ + // Configuration: &armappcontainers.Configuration{ + // Ingress: &armappcontainers.Ingress{ + // ExposedPort: to.Ptr[int32](4000), + // External: to.Ptr(true), + // Fqdn: to.Ptr("testcontainerAppTcp.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // TargetPort: to.Ptr[int32](3000), + // Traffic: []*armappcontainers.TrafficWeight{ + // { + // RevisionName: to.Ptr("testcontainerAppTcp-ab1234"), + // Weight: to.Ptr[int32](80), + // }, + // { + // RevisionName: to.Ptr("testcontainerAppTcp-ab4321"), + // Weight: to.Ptr[int32](20), + // }}, + // Transport: to.Ptr(armappcontainers.IngressTransportMethodTCP), + // }, + // }, + // LatestReadyRevisionName: to.Ptr("testcontainerAppTcp-pjxhsye"), + // LatestRevisionFqdn: to.Ptr("testcontainerAppTcp-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), + // Template: &armappcontainers.Template{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerAppTcp"), + // Image: to.Ptr("repo/testcontainerAppTcp:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // Probes: []*armappcontainers.ContainerAppProbe{ + // { + // Type: to.Ptr(armappcontainers.TypeLiveness), + // InitialDelaySeconds: to.Ptr[int32](3), + // PeriodSeconds: to.Ptr[int32](3), + // TCPSocket: &armappcontainers.ContainerAppProbeTCPSocket{ + // Port: to.Ptr[int32](8080), + // }, + // }}, + // }}, + // Scale: &armappcontainers.Scale{ + // MaxReplicas: to.Ptr[int32](5), + // MinReplicas: to.Ptr[int32](1), + // Rules: []*armappcontainers.ScaleRule{ + // { + // Name: to.Ptr("tcpscalingrule"), + // TCP: &armappcontainers.TCPScaleRule{ + // Metadata: map[string]*string{ + // "concurrentConnections": to.Ptr("50"), + // }, + // }, + // }}, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Delete.json func ExampleContainerAppsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -499,7 +955,7 @@ func ExampleContainerAppsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_Patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Patch.json func ExampleContainerAppsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -519,9 +975,13 @@ func ExampleContainerAppsClient_BeginUpdate() { Properties: &armappcontainers.ContainerAppProperties{ Configuration: &armappcontainers.Configuration{ Dapr: &armappcontainers.Dapr{ - AppPort: to.Ptr[int32](3000), - AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), - Enabled: to.Ptr(true), + AppPort: to.Ptr[int32](3000), + AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), + EnableAPILogging: to.Ptr(true), + Enabled: to.Ptr(true), + HTTPMaxRequestSize: to.Ptr[int32](10), + HTTPReadBufferSize: to.Ptr[int32](30), + LogLevel: to.Ptr(armappcontainers.LogLevelDebug), }, Ingress: &armappcontainers.Ingress{ CustomDomains: []*armappcontainers.CustomDomain{ @@ -535,7 +995,23 @@ func ExampleContainerAppsClient_BeginUpdate() { BindingType: to.Ptr(armappcontainers.BindingTypeSniEnabled), CertificateID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com"), }}, - External: to.Ptr(true), + External: to.Ptr(true), + IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ + { + Name: to.Ptr("Allow work IP A subnet"), + Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + Action: to.Ptr(armappcontainers.ActionAllow), + IPAddressRange: to.Ptr("192.168.1.1/32"), + }, + { + Name: to.Ptr("Allow work IP B subnet"), + Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + Action: to.Ptr(armappcontainers.ActionAllow), + IPAddressRange: to.Ptr("192.168.1.1/8"), + }}, + StickySessions: &armappcontainers.IngressStickySessions{ + Affinity: to.Ptr(armappcontainers.AffinitySticky), + }, TargetPort: to.Ptr[int32](3000), Traffic: []*armappcontainers.TrafficWeight{ { @@ -544,6 +1020,7 @@ func ExampleContainerAppsClient_BeginUpdate() { Weight: to.Ptr[int32](100), }}, }, + MaxInactiveRevisions: to.Ptr[int32](10), }, Template: &armappcontainers.Template{ Containers: []*armappcontainers.Container{ @@ -566,6 +1043,15 @@ func ExampleContainerAppsClient_BeginUpdate() { PeriodSeconds: to.Ptr[int32](3), }}, }}, + InitContainers: []*armappcontainers.InitContainer{ + { + Name: to.Ptr("testinitcontainerApp0"), + Image: to.Ptr("repo/testcontainerApp0:v4"), + Resources: &armappcontainers.ContainerResources{ + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), + }, + }}, Scale: &armappcontainers.Scale{ MaxReplicas: to.Ptr[int32](5), MinReplicas: to.Ptr[int32](1), @@ -586,13 +1072,115 @@ func ExampleContainerAppsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContainerApp = armappcontainers.ContainerApp{ + // Name: to.Ptr("testcontainerApp0"), + // Type: to.Ptr("Microsoft.App/containerApps"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ContainerAppProperties{ + // Configuration: &armappcontainers.Configuration{ + // Dapr: &armappcontainers.Dapr{ + // AppPort: to.Ptr[int32](3000), + // AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), + // EnableAPILogging: to.Ptr(true), + // Enabled: to.Ptr(true), + // HTTPMaxRequestSize: to.Ptr[int32](10), + // HTTPReadBufferSize: to.Ptr[int32](30), + // LogLevel: to.Ptr(armappcontainers.LogLevelDebug), + // }, + // Ingress: &armappcontainers.Ingress{ + // CustomDomains: []*armappcontainers.CustomDomain{ + // { + // Name: to.Ptr("www.my-name.com"), + // BindingType: to.Ptr(armappcontainers.BindingTypeSniEnabled), + // CertificateID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com"), + // }, + // { + // Name: to.Ptr("www.my--other-name.com"), + // BindingType: to.Ptr(armappcontainers.BindingTypeSniEnabled), + // CertificateID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com"), + // }}, + // External: to.Ptr(true), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ + // { + // Name: to.Ptr("Allow work IP A subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/32"), + // }, + // { + // Name: to.Ptr("Allow work IP B subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/8"), + // }}, + // TargetPort: to.Ptr[int32](3000), + // Traffic: []*armappcontainers.TrafficWeight{ + // { + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), + // Weight: to.Ptr[int32](80), + // }, + // { + // Label: to.Ptr("staging"), + // RevisionName: to.Ptr("testcontainerApp0-ab4321"), + // Weight: to.Ptr[int32](20), + // }}, + // Transport: to.Ptr(armappcontainers.IngressTransportMethodAuto), + // }, + // MaxInactiveRevisions: to.Ptr[int32](10), + // }, + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // LatestReadyRevisionName: to.Ptr("testcontainerApp0-pjxhsye"), + // LatestRevisionFqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), + // Template: &armappcontainers.Template{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // Scale: &armappcontainers.Scale{ + // MaxReplicas: to.Ptr[int32](5), + // MinReplicas: to.Ptr[int32](1), + // Rules: []*armappcontainers.ScaleRule{ + // { + // Name: to.Ptr("httpscalingrule"), + // HTTP: &armappcontainers.HTTPScaleRule{ + // Metadata: map[string]*string{ + // "concurrentRequests": to.Ptr("50"), + // }, + // }, + // }}, + // }, + // }, + // WorkloadProfileName: to.Ptr("My-GP-01"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_ListCustomHostNameAnalysis.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json func ExampleContainerAppsClient_ListCustomHostNameAnalysis() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -611,35 +1199,32 @@ func ExampleContainerAppsClient_ListCustomHostNameAnalysis() { _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.CustomHostnameAnalysisResult = armappcontainers.CustomHostnameAnalysisResult{ - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0"), - // Properties: &armappcontainers.CustomHostnameAnalysisResultProperties{ - // ARecords: []*string{ - // to.Ptr("aRecord1"), - // to.Ptr("aRecord2")}, - // AlternateCNameRecords: []*string{ - // to.Ptr("cNameRecord1"), - // to.Ptr("cNameRecord2")}, - // AlternateTxtRecords: []*string{ - // to.Ptr("txtRecord1"), - // to.Ptr("txtRecord2")}, - // CNameRecords: []*string{ - // to.Ptr("cNameRecord1"), - // to.Ptr("cNameRecord2")}, - // ConflictingContainerAppResourceID: to.Ptr(""), - // CustomDomainVerificationFailureInfo: &armappcontainers.DefaultErrorResponse{ - // }, - // CustomDomainVerificationTest: to.Ptr(armappcontainers.DNSVerificationTestResultPassed), - // HasConflictOnManagedEnvironment: to.Ptr(false), - // HostName: to.Ptr("my.name.corp"), - // IsHostnameAlreadyVerified: to.Ptr(true), - // TxtRecords: []*string{ - // to.Ptr("txtRecord1"), - // to.Ptr("txtRecord2")}, - // }, + // ARecords: []*string{ + // to.Ptr("aRecord1"), + // to.Ptr("aRecord2")}, + // AlternateCNameRecords: []*string{ + // to.Ptr("cNameRecord1"), + // to.Ptr("cNameRecord2")}, + // AlternateTxtRecords: []*string{ + // to.Ptr("txtRecord1"), + // to.Ptr("txtRecord2")}, + // CNameRecords: []*string{ + // to.Ptr("cNameRecord1"), + // to.Ptr("cNameRecord2")}, + // ConflictingContainerAppResourceID: to.Ptr(""), + // CustomDomainVerificationFailureInfo: &armappcontainers.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo{ + // }, + // CustomDomainVerificationTest: to.Ptr(armappcontainers.DNSVerificationTestResultPassed), + // HasConflictOnManagedEnvironment: to.Ptr(false), + // HostName: to.Ptr("my.name.corp"), + // IsHostnameAlreadyVerified: to.Ptr(true), + // TxtRecords: []*string{ + // to.Ptr("txtRecord1"), + // to.Ptr("txtRecord2")}, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_ListSecrets.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListSecrets.json func ExampleContainerAppsClient_ListSecrets() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -667,3 +1252,33 @@ func ExampleContainerAppsClient_ListSecrets() { // }}, // } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_GetAuthToken.json +func ExampleContainerAppsClient_GetAuthToken() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewContainerAppsClient().GetAuthToken(ctx, "rg", "testcontainerApp0", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContainerAppAuthToken = armappcontainers.ContainerAppAuthToken{ + // Name: to.Ptr("testcontainerApp0"), + // Type: to.Ptr("Microsoft.App/containerApps/accesstoken"), + // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ContainerAppAuthTokenProperties{ + // Expires: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-14T19:22:50.3080223Z"); return t}()), + // Token: to.Ptr("testToken"), + // }, + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go index 0ae4137afeda..cec5e70a55f0 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go @@ -47,7 +47,7 @@ func NewContainerAppsAuthConfigsClient(subscriptionID string, credential azcore. // CreateOrUpdate - Create or update the AuthConfig for a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - authConfigName - Name of the Container App AuthConfig. @@ -93,7 +93,7 @@ func (client *ContainerAppsAuthConfigsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, authConfigEnvelope) @@ -111,7 +111,7 @@ func (client *ContainerAppsAuthConfigsClient) createOrUpdateHandleResponse(resp // Delete - Delete a Container App AuthConfig. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - authConfigName - Name of the Container App AuthConfig. @@ -156,7 +156,7 @@ func (client *ContainerAppsAuthConfigsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -165,7 +165,7 @@ func (client *ContainerAppsAuthConfigsClient) deleteCreateRequest(ctx context.Co // Get - Get a AuthConfig of a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - authConfigName - Name of the Container App AuthConfig. @@ -210,7 +210,7 @@ func (client *ContainerAppsAuthConfigsClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -227,7 +227,7 @@ func (client *ContainerAppsAuthConfigsClient) getHandleResponse(resp *http.Respo // NewListByContainerAppPager - Get the Container App AuthConfigs in a given resource group. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - options - ContainerAppsAuthConfigsClientListByContainerAppOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.NewListByContainerAppPager @@ -280,7 +280,7 @@ func (client *ContainerAppsAuthConfigsClient) listByContainerAppCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client_example_test.go index 1801536f70f1..3db095ba8a45 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/AuthConfigs_ListByContainer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_ListByContainer.json func ExampleContainerAppsAuthConfigsClient_NewListByContainerAppPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -67,7 +67,7 @@ func ExampleContainerAppsAuthConfigsClient_NewListByContainerAppPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/AuthConfigs_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Get.json func ExampleContainerAppsAuthConfigsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -108,7 +108,7 @@ func ExampleContainerAppsAuthConfigsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/AuthConfigs_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_CreateOrUpdate.json func ExampleContainerAppsAuthConfigsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -166,7 +166,7 @@ func ExampleContainerAppsAuthConfigsClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/AuthConfigs_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Delete.json func ExampleContainerAppsAuthConfigsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go new file mode 100644 index 000000000000..9c9e36ff9293 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go @@ -0,0 +1,372 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ContainerAppsDiagnosticsClient contains the methods for the ContainerAppsDiagnostics group. +// Don't use this type directly, use NewContainerAppsDiagnosticsClient() instead. +type ContainerAppsDiagnosticsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContainerAppsDiagnosticsClient creates a new instance of ContainerAppsDiagnosticsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewContainerAppsDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsDiagnosticsClient, error) { + cl, err := arm.NewClient(moduleName+".ContainerAppsDiagnosticsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContainerAppsDiagnosticsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetDetector - Get a diagnostics result of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - containerAppName - Name of the Container App. +// - detectorName - Name of the Container App Detector. +// - options - ContainerAppsDiagnosticsClientGetDetectorOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetDetector +// method. +func (client *ContainerAppsDiagnosticsClient) GetDetector(ctx context.Context, resourceGroupName string, containerAppName string, detectorName string, options *ContainerAppsDiagnosticsClientGetDetectorOptions) (ContainerAppsDiagnosticsClientGetDetectorResponse, error) { + req, err := client.getDetectorCreateRequest(ctx, resourceGroupName, containerAppName, detectorName, options) + if err != nil { + return ContainerAppsDiagnosticsClientGetDetectorResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientGetDetectorResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientGetDetectorResponse{}, runtime.NewResponseError(resp) + } + return client.getDetectorHandleResponse(resp) +} + +// getDetectorCreateRequest creates the GetDetector request. +func (client *ContainerAppsDiagnosticsClient) getDetectorCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, detectorName string, options *ContainerAppsDiagnosticsClientGetDetectorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if detectorName == "" { + return nil, errors.New("parameter detectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{detectorName}", url.PathEscape(detectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDetectorHandleResponse handles the GetDetector response. +func (client *ContainerAppsDiagnosticsClient) getDetectorHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientGetDetectorResponse, error) { + result := ContainerAppsDiagnosticsClientGetDetectorResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Diagnostics); err != nil { + return ContainerAppsDiagnosticsClientGetDetectorResponse{}, err + } + return result, nil +} + +// GetRevision - Get a revision of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - containerAppName - Name of the Container App. +// - revisionName - Name of the Container App Revision. +// - options - ContainerAppsDiagnosticsClientGetRevisionOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetRevision +// method. +func (client *ContainerAppsDiagnosticsClient) GetRevision(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsDiagnosticsClientGetRevisionOptions) (ContainerAppsDiagnosticsClientGetRevisionResponse, error) { + req, err := client.getRevisionCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, options) + if err != nil { + return ContainerAppsDiagnosticsClientGetRevisionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientGetRevisionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientGetRevisionResponse{}, runtime.NewResponseError(resp) + } + return client.getRevisionHandleResponse(resp) +} + +// getRevisionCreateRequest creates the GetRevision request. +func (client *ContainerAppsDiagnosticsClient) getRevisionCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, options *ContainerAppsDiagnosticsClientGetRevisionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getRevisionHandleResponse handles the GetRevision response. +func (client *ContainerAppsDiagnosticsClient) getRevisionHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientGetRevisionResponse, error) { + result := ContainerAppsDiagnosticsClientGetRevisionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Revision); err != nil { + return ContainerAppsDiagnosticsClientGetRevisionResponse{}, err + } + return result, nil +} + +// GetRoot - Get the properties of a Container App. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - containerAppName - Name of the Container App. +// - options - ContainerAppsDiagnosticsClientGetRootOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetRoot +// method. +func (client *ContainerAppsDiagnosticsClient) GetRoot(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientGetRootOptions) (ContainerAppsDiagnosticsClientGetRootResponse, error) { + req, err := client.getRootCreateRequest(ctx, resourceGroupName, containerAppName, options) + if err != nil { + return ContainerAppsDiagnosticsClientGetRootResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientGetRootResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientGetRootResponse{}, runtime.NewResponseError(resp) + } + return client.getRootHandleResponse(resp) +} + +// getRootCreateRequest creates the GetRoot request. +func (client *ContainerAppsDiagnosticsClient) getRootCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientGetRootOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getRootHandleResponse handles the GetRoot response. +func (client *ContainerAppsDiagnosticsClient) getRootHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientGetRootResponse, error) { + result := ContainerAppsDiagnosticsClientGetRootResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerApp); err != nil { + return ContainerAppsDiagnosticsClientGetRootResponse{}, err + } + return result, nil +} + +// NewListDetectorsPager - Get the list of diagnostics for a given Container App. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - containerAppName - Name of the Container App for which detector info is needed. +// - options - ContainerAppsDiagnosticsClientListDetectorsOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.NewListDetectorsPager +// method. +func (client *ContainerAppsDiagnosticsClient) NewListDetectorsPager(resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientListDetectorsOptions) *runtime.Pager[ContainerAppsDiagnosticsClientListDetectorsResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsDiagnosticsClientListDetectorsResponse]{ + More: func(page ContainerAppsDiagnosticsClientListDetectorsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsDiagnosticsClientListDetectorsResponse) (ContainerAppsDiagnosticsClientListDetectorsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listDetectorsCreateRequest(ctx, resourceGroupName, containerAppName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsDiagnosticsClientListDetectorsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientListDetectorsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientListDetectorsResponse{}, runtime.NewResponseError(resp) + } + return client.listDetectorsHandleResponse(resp) + }, + }) +} + +// listDetectorsCreateRequest creates the ListDetectors request. +func (client *ContainerAppsDiagnosticsClient) listDetectorsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientListDetectorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listDetectorsHandleResponse handles the ListDetectors response. +func (client *ContainerAppsDiagnosticsClient) listDetectorsHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientListDetectorsResponse, error) { + result := ContainerAppsDiagnosticsClientListDetectorsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticsCollection); err != nil { + return ContainerAppsDiagnosticsClientListDetectorsResponse{}, err + } + return result, nil +} + +// NewListRevisionsPager - Get the Revisions for a given Container App. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - containerAppName - Name of the Container App for which Revisions are needed. +// - options - ContainerAppsDiagnosticsClientListRevisionsOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.NewListRevisionsPager +// method. +func (client *ContainerAppsDiagnosticsClient) NewListRevisionsPager(resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientListRevisionsOptions) *runtime.Pager[ContainerAppsDiagnosticsClientListRevisionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsDiagnosticsClientListRevisionsResponse]{ + More: func(page ContainerAppsDiagnosticsClientListRevisionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsDiagnosticsClientListRevisionsResponse) (ContainerAppsDiagnosticsClientListRevisionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listRevisionsCreateRequest(ctx, resourceGroupName, containerAppName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ContainerAppsDiagnosticsClientListRevisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsDiagnosticsClientListRevisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerAppsDiagnosticsClientListRevisionsResponse{}, runtime.NewResponseError(resp) + } + return client.listRevisionsHandleResponse(resp) + }, + }) +} + +// listRevisionsCreateRequest creates the ListRevisions request. +func (client *ContainerAppsDiagnosticsClient) listRevisionsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsDiagnosticsClientListRevisionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listRevisionsHandleResponse handles the ListRevisions response. +func (client *ContainerAppsDiagnosticsClient) listRevisionsHandleResponse(resp *http.Response) (ContainerAppsDiagnosticsClientListRevisionsResponse, error) { + result := ContainerAppsDiagnosticsClientListRevisionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RevisionCollection); err != nil { + return ContainerAppsDiagnosticsClientListRevisionsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go new file mode 100644 index 000000000000..99f11a5c1ee2 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go @@ -0,0 +1,384 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_List.json +func ExampleContainerAppsDiagnosticsClient_NewListDetectorsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewContainerAppsDiagnosticsClient().NewListDetectorsPager("mikono-workerapp-test-rg", "mikono-capp-stage1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.DiagnosticsCollection = armappcontainers.DiagnosticsCollection{ + // Value: []*armappcontainers.Diagnostics{ + // { + // Name: to.Ptr("cappContainerAppAvailabilityMetrics"), + // Type: to.Ptr("Microsoft.App/containerapps/detectors"), + // ID: to.Ptr("/subscriptions/f07f3711-b45e-40fe-a941-4e6d93f851e6/resourceGroups/mikono-workerapp-test-rg/providers/Microsoft.App/containerApps/mikono-capp-stage1/detectors/cappContainerAppAvailabilityMetrics"), + // Properties: &armappcontainers.DiagnosticsProperties{ + // Dataset: []*armappcontainers.DiagnosticsDataAPIResponse{ + // }, + // Metadata: &armappcontainers.DiagnosticsDefinition{ + // Name: to.Ptr("Availability Metrics for Container Apps"), + // Type: to.Ptr("Analysis"), + // Author: to.Ptr(""), + // Category: to.Ptr("Availability and Performance"), + // ID: to.Ptr("cappContainerAppAvailabilityMetrics"), + // Score: to.Ptr[float32](0), + // SupportTopicList: []*armappcontainers.DiagnosticSupportTopic{ + // }, + // }, + // Status: &armappcontainers.DiagnosticsStatus{ + // StatusID: to.Ptr[int32](4), + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_Get.json +func ExampleContainerAppsDiagnosticsClient_GetDetector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewContainerAppsDiagnosticsClient().GetDetector(ctx, "mikono-workerapp-test-rg", "mikono-capp-stage1", "cappcontainerappnetworkIO", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Diagnostics = armappcontainers.Diagnostics{ + // Name: to.Ptr("cappcontainerappnetworkIO"), + // Type: to.Ptr("Microsoft.App/containerapps/detectors"), + // ID: to.Ptr("/subscriptions/f07f3711-b45e-40fe-a941-4e6d93f851e6/resourceGroups/mikono-workerapp-test-rg/providers/Microsoft.App/containerApps/mikono-capp-stage1/detectors/cappcontainerappnetworkIO"), + // Properties: &armappcontainers.DiagnosticsProperties{ + // Dataset: []*armappcontainers.DiagnosticsDataAPIResponse{ + // { + // RenderingProperties: &armappcontainers.DiagnosticRendering{ + // Type: to.Ptr[int32](8), + // Description: to.Ptr(""), + // IsVisible: to.Ptr(true), + // Title: to.Ptr("Container Apps Network Inbound "), + // }, + // Table: &armappcontainers.DiagnosticDataTableResponseObject{ + // Columns: []*armappcontainers.DiagnosticDataTableResponseColumn{ + // { + // ColumnName: to.Ptr("TimeStamp"), + // DataType: to.Ptr("DateTime"), + // }, + // { + // ColumnName: to.Ptr("Metric"), + // DataType: to.Ptr("String"), + // }, + // { + // ColumnName: to.Ptr("Average"), + // DataType: to.Ptr("Double"), + // }}, + // Rows: []any{ + // []any{ + // "2022-03-15T21:35:00", + // "RxBytes", + // float64(0), + // }}, + // TableName: to.Ptr(""), + // }, + // }}, + // Metadata: &armappcontainers.DiagnosticsDefinition{ + // Name: to.Ptr("Container App Network Inbound and Outbound"), + // Type: to.Ptr("Detector"), + // Description: to.Ptr("This detector shows the Container App Network Inbound and Outbound."), + // Author: to.Ptr(""), + // Category: to.Ptr("Availability and Performance"), + // ID: to.Ptr("cappcontainerappnetworkIO"), + // Score: to.Ptr[float32](0), + // SupportTopicList: []*armappcontainers.DiagnosticSupportTopic{ + // }, + // }, + // Status: &armappcontainers.DiagnosticsStatus{ + // StatusID: to.Ptr[int32](3), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json +func ExampleContainerAppsDiagnosticsClient_NewListRevisionsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewContainerAppsDiagnosticsClient().NewListRevisionsPager("rg", "testcontainerApp0", &armappcontainers.ContainerAppsDiagnosticsClientListRevisionsOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.RevisionCollection = armappcontainers.RevisionCollection{ + // Value: []*armappcontainers.Revision{ + // { + // Name: to.Ptr("testcontainerApp0-pjxhsye"), + // Type: to.Ptr("Microsoft.App/containerApps/revisions"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0/revisions/testcontainerApp0-pjxhsye"), + // Properties: &armappcontainers.RevisionProperties{ + // Active: to.Ptr(true), + // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-24T21:24:22+00:00"); return t}()), + // Fqdn: to.Ptr("testcontainerApp0-pjxhsye.politehill-ab123456.eastus.azurecontainerapps.io"), + // LastActiveTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-24T21:24:22+00:00"); return t}()), + // Replicas: to.Ptr[int32](1), + // Template: &armappcontainers.Template{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v2"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // Scale: &armappcontainers.Scale{ + // MaxReplicas: to.Ptr[int32](5), + // MinReplicas: to.Ptr[int32](1), + // Rules: []*armappcontainers.ScaleRule{ + // { + // Name: to.Ptr("httpscalingrule"), + // HTTP: &armappcontainers.HTTPScaleRule{ + // Metadata: map[string]*string{ + // "concurrentRequests": to.Ptr("50"), + // }, + // }, + // }}, + // }, + // }, + // TrafficWeight: to.Ptr[int32](80), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json +func ExampleContainerAppsDiagnosticsClient_GetRevision() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewContainerAppsDiagnosticsClient().GetRevision(ctx, "rg", "testcontainerApp0", "testcontainerApp0-pjxhsye", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Revision = armappcontainers.Revision{ + // Name: to.Ptr("testcontainerApp0-pjxhsye"), + // Type: to.Ptr("Microsoft.App/containerApps/revisions"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppcontainerApps/testcontainerApp0/revisions/testcontainerApp0-pjxhsye"), + // Properties: &armappcontainers.RevisionProperties{ + // Active: to.Ptr(true), + // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-24T21:24:22+00:00"); return t}()), + // Fqdn: to.Ptr("testcontainerApp0-pjxhsye.politehill-ab123456.eastus.azurecontainerapps.io"), + // LastActiveTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-24T21:24:22+00:00"); return t}()), + // Replicas: to.Ptr[int32](1), + // Template: &armappcontainers.Template{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v2"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // Scale: &armappcontainers.Scale{ + // MaxReplicas: to.Ptr[int32](5), + // MinReplicas: to.Ptr[int32](1), + // Rules: []*armappcontainers.ScaleRule{ + // { + // Name: to.Ptr("httpscalingrule"), + // HTTP: &armappcontainers.HTTPScaleRule{ + // Metadata: map[string]*string{ + // "concurrentRequests": to.Ptr("50"), + // }, + // }, + // }}, + // }, + // }, + // TrafficWeight: to.Ptr[int32](80), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json +func ExampleContainerAppsDiagnosticsClient_GetRoot() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewContainerAppsDiagnosticsClient().GetRoot(ctx, "rg", "testcontainerApp0", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContainerApp = armappcontainers.ContainerApp{ + // Name: to.Ptr("testcontainerApp0"), + // Type: to.Ptr("Microsoft.App/containerApps"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ContainerAppProperties{ + // Configuration: &armappcontainers.Configuration{ + // Dapr: &armappcontainers.Dapr{ + // AppPort: to.Ptr[int32](3000), + // AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), + // EnableAPILogging: to.Ptr(true), + // Enabled: to.Ptr(true), + // HTTPMaxRequestSize: to.Ptr[int32](10), + // HTTPReadBufferSize: to.Ptr[int32](30), + // LogLevel: to.Ptr(armappcontainers.LogLevelDebug), + // }, + // Ingress: &armappcontainers.Ingress{ + // CustomDomains: []*armappcontainers.CustomDomain{ + // { + // Name: to.Ptr("www.my-name.com"), + // BindingType: to.Ptr(armappcontainers.BindingTypeSniEnabled), + // CertificateID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com"), + // }, + // { + // Name: to.Ptr("www.my--other-name.com"), + // BindingType: to.Ptr(armappcontainers.BindingTypeSniEnabled), + // CertificateID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com"), + // }}, + // External: to.Ptr(true), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ + // { + // Name: to.Ptr("Allow work IP A subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/32"), + // }, + // { + // Name: to.Ptr("Allow work IP B subnet"), + // Description: to.Ptr("Allowing all IP's within the subnet below to access containerapp"), + // Action: to.Ptr(armappcontainers.ActionAllow), + // IPAddressRange: to.Ptr("192.168.1.1/8"), + // }}, + // StickySessions: &armappcontainers.IngressStickySessions{ + // Affinity: to.Ptr(armappcontainers.AffinitySticky), + // }, + // TargetPort: to.Ptr[int32](3000), + // Traffic: []*armappcontainers.TrafficWeight{ + // { + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), + // Weight: to.Ptr[int32](80), + // }, + // { + // Label: to.Ptr("staging"), + // RevisionName: to.Ptr("testcontainerApp0-ab4321"), + // Weight: to.Ptr[int32](20), + // }}, + // Transport: to.Ptr(armappcontainers.IngressTransportMethodAuto), + // }, + // MaxInactiveRevisions: to.Ptr[int32](10), + // }, + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // LatestReadyRevisionName: to.Ptr("testcontainerApp0-pjxhsye"), + // LatestRevisionFqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), + // Template: &armappcontainers.Template{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // Scale: &armappcontainers.Scale{ + // MaxReplicas: to.Ptr[int32](5), + // MinReplicas: to.Ptr[int32](1), + // Rules: []*armappcontainers.ScaleRule{ + // { + // Name: to.Ptr("httpscalingrule"), + // HTTP: &armappcontainers.HTTPScaleRule{ + // Metadata: map[string]*string{ + // "concurrentRequests": to.Ptr("50"), + // }, + // }, + // }}, + // }, + // }, + // WorkloadProfileName: to.Ptr("My-GP-01"), + // }, + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go index fe9d32a80612..a1a0137ae98a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go @@ -47,7 +47,7 @@ func NewContainerAppsRevisionReplicasClient(subscriptionID string, credential az // GetReplica - Get a replica for a Container App Revision. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - revisionName - Name of the Container App Revision. @@ -97,7 +97,7 @@ func (client *ContainerAppsRevisionReplicasClient) getReplicaCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +115,7 @@ func (client *ContainerAppsRevisionReplicasClient) getReplicaHandleResponse(resp // ListReplicas - List replicas for a Container App Revision. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - revisionName - Name of the Container App Revision. @@ -160,7 +160,7 @@ func (client *ContainerAppsRevisionReplicasClient) listReplicasCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client_example_test.go index b5b860980ff6..dbe619cf87d3 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Replicas_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_Get.json func ExampleContainerAppsRevisionReplicasClient_GetReplica() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -44,6 +44,8 @@ func ExampleContainerAppsRevisionReplicasClient_GetReplica() { // { // Name: to.Ptr("hello92"), // ContainerID: to.Ptr("containerd://6bac7bb3afed1c704b5fe563c34c0ecf59ac30c766bb73488f7fa552dc42ee54"), + // ExecEndpoint: to.Ptr("testExecEndpoint"), + // LogStreamEndpoint: to.Ptr("testLogStreamEndpoint"), // Ready: to.Ptr(true), // RestartCount: to.Ptr[int32](0), // Started: to.Ptr(true), @@ -53,7 +55,7 @@ func ExampleContainerAppsRevisionReplicasClient_GetReplica() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Replicas_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_List.json func ExampleContainerAppsRevisionReplicasClient_ListReplicas() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -82,6 +84,8 @@ func ExampleContainerAppsRevisionReplicasClient_ListReplicas() { // { // Name: to.Ptr("hello92"), // ContainerID: to.Ptr("containerd://6bac7bb3afed1c704b5fe563c34c0ecf59ac30c766bb73488f7fa552dc42ee54"), + // ExecEndpoint: to.Ptr("testExecEndpoint"), + // LogStreamEndpoint: to.Ptr("testLogStreamEndpoint"), // Ready: to.Ptr(true), // RestartCount: to.Ptr[int32](0), // Started: to.Ptr(true), diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go index 2a5a3367420f..1c1f7fce3e9c 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go @@ -47,7 +47,7 @@ func NewContainerAppsRevisionsClient(subscriptionID string, credential azcore.To // ActivateRevision - Activates a revision for a Container App // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - revisionName - Name of the Container App Revision. @@ -92,7 +92,7 @@ func (client *ContainerAppsRevisionsClient) activateRevisionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -101,7 +101,7 @@ func (client *ContainerAppsRevisionsClient) activateRevisionCreateRequest(ctx co // DeactivateRevision - Deactivates a revision for a Container App // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - revisionName - Name of the Container App Revision. @@ -146,7 +146,7 @@ func (client *ContainerAppsRevisionsClient) deactivateRevisionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -155,7 +155,7 @@ func (client *ContainerAppsRevisionsClient) deactivateRevisionCreateRequest(ctx // GetRevision - Get a revision of a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - revisionName - Name of the Container App Revision. @@ -200,7 +200,7 @@ func (client *ContainerAppsRevisionsClient) getRevisionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -217,7 +217,7 @@ func (client *ContainerAppsRevisionsClient) getRevisionHandleResponse(resp *http // NewListRevisionsPager - Get the Revisions for a given Container App. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App for which Revisions are needed. // - options - ContainerAppsRevisionsClientListRevisionsOptions contains the optional parameters for the ContainerAppsRevisionsClient.NewListRevisionsPager @@ -270,7 +270,7 @@ func (client *ContainerAppsRevisionsClient) listRevisionsCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -291,7 +291,7 @@ func (client *ContainerAppsRevisionsClient) listRevisionsHandleResponse(resp *ht // RestartRevision - Restarts a revision for a Container App // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - revisionName - Name of the Container App Revision. @@ -336,7 +336,7 @@ func (client *ContainerAppsRevisionsClient) restartRevisionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client_example_test.go index 2664ec7967f3..82a1a713f28c 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Revisions_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json func ExampleContainerAppsRevisionsClient_NewListRevisionsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -48,7 +48,8 @@ func ExampleContainerAppsRevisionsClient_NewListRevisionsPager() { // Properties: &armappcontainers.RevisionProperties{ // Active: to.Ptr(true), // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-24T21:24:22+00:00"); return t}()), - // Fqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerapps.k4apps.io"), + // Fqdn: to.Ptr("testcontainerApp0-pjxhsye.politehill-ab123456.eastus.azurecontainerapps.io"), + // LastActiveTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-24T21:24:22+00:00"); return t}()), // Replicas: to.Ptr[int32](1), // Template: &armappcontainers.Template{ // Containers: []*armappcontainers.Container{ @@ -74,13 +75,14 @@ func ExampleContainerAppsRevisionsClient_NewListRevisionsPager() { // }}, // }, // }, + // TrafficWeight: to.Ptr[int32](80), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Revisions_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json func ExampleContainerAppsRevisionsClient_GetRevision() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +107,8 @@ func ExampleContainerAppsRevisionsClient_GetRevision() { // Properties: &armappcontainers.RevisionProperties{ // Active: to.Ptr(true), // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-24T21:24:22+00:00"); return t}()), - // Fqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), + // Fqdn: to.Ptr("testcontainerApp0-pjxhsye.politehill-ab123456.eastus.azurecontainerapps.io"), + // LastActiveTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-24T21:24:22+00:00"); return t}()), // Replicas: to.Ptr[int32](1), // Template: &armappcontainers.Template{ // Containers: []*armappcontainers.Container{ @@ -131,11 +134,12 @@ func ExampleContainerAppsRevisionsClient_GetRevision() { // }}, // }, // }, + // TrafficWeight: to.Ptr[int32](80), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Revisions_Activate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Activate.json func ExampleContainerAppsRevisionsClient_ActivateRevision() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -152,7 +156,7 @@ func ExampleContainerAppsRevisionsClient_ActivateRevision() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Revisions_Deactivate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Deactivate.json func ExampleContainerAppsRevisionsClient_DeactivateRevision() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -169,7 +173,7 @@ func ExampleContainerAppsRevisionsClient_DeactivateRevision() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Revisions_Restart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Restart.json func ExampleContainerAppsRevisionsClient_RestartRevision() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go index a1491cb93d6b..72ce2837ec78 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go @@ -47,7 +47,7 @@ func NewContainerAppsSourceControlsClient(subscriptionID string, credential azco // BeginCreateOrUpdate - Create or update the SourceControl for a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - sourceControlName - Name of the Container App SourceControl. @@ -69,7 +69,7 @@ func (client *ContainerAppsSourceControlsClient) BeginCreateOrUpdate(ctx context // CreateOrUpdate - Create or update the SourceControl for a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview func (client *ContainerAppsSourceControlsClient) createOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, sourceControlEnvelope SourceControl, options *ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, containerAppName, sourceControlName, sourceControlEnvelope, options) if err != nil { @@ -79,7 +79,7 @@ func (client *ContainerAppsSourceControlsClient) createOrUpdate(ctx context.Cont if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, runtime.NewResponseError(resp) } return resp, nil @@ -109,7 +109,7 @@ func (client *ContainerAppsSourceControlsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sourceControlEnvelope) @@ -118,7 +118,7 @@ func (client *ContainerAppsSourceControlsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a Container App SourceControl. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - sourceControlName - Name of the Container App SourceControl. @@ -139,7 +139,7 @@ func (client *ContainerAppsSourceControlsClient) BeginDelete(ctx context.Context // Delete - Delete a Container App SourceControl. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview func (client *ContainerAppsSourceControlsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, options *ContainerAppsSourceControlsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, containerAppName, sourceControlName, options) if err != nil { @@ -179,7 +179,7 @@ func (client *ContainerAppsSourceControlsClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +188,7 @@ func (client *ContainerAppsSourceControlsClient) deleteCreateRequest(ctx context // Get - Get a SourceControl of a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - sourceControlName - Name of the Container App SourceControl. @@ -233,7 +233,7 @@ func (client *ContainerAppsSourceControlsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +250,7 @@ func (client *ContainerAppsSourceControlsClient) getHandleResponse(resp *http.Re // NewListByContainerAppPager - Get the Container App SourceControls in a given resource group. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - options - ContainerAppsSourceControlsClientListByContainerAppOptions contains the optional parameters for the ContainerAppsSourceControlsClient.NewListByContainerAppPager @@ -303,7 +303,7 @@ func (client *ContainerAppsSourceControlsClient) listByContainerAppCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client_example_test.go index 0d9ab9d1e06d..35412f4c0de2 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/SourceControls_ListByContainer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_ListByContainer.json func ExampleContainerAppsSourceControlsClient_NewListByContainerAppPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -63,7 +63,7 @@ func ExampleContainerAppsSourceControlsClient_NewListByContainerAppPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/SourceControls_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Get.json func ExampleContainerAppsSourceControlsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -100,7 +100,7 @@ func ExampleContainerAppsSourceControlsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/SourceControls_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_CreateOrUpdate.json func ExampleContainerAppsSourceControlsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -161,7 +161,7 @@ func ExampleContainerAppsSourceControlsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/SourceControls_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Delete.json func ExampleContainerAppsSourceControlsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go index 594f1f644746..002ca5c3358e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go @@ -47,7 +47,7 @@ func NewDaprComponentsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Creates or updates a Dapr Component in a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - componentName - Name of the Dapr Component. @@ -93,7 +93,7 @@ func (client *DaprComponentsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, daprComponentEnvelope) @@ -111,7 +111,7 @@ func (client *DaprComponentsClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Delete a Dapr Component from a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - componentName - Name of the Dapr Component. @@ -155,7 +155,7 @@ func (client *DaprComponentsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -164,7 +164,7 @@ func (client *DaprComponentsClient) deleteCreateRequest(ctx context.Context, res // Get - Get a dapr component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - componentName - Name of the Dapr Component. @@ -208,7 +208,7 @@ func (client *DaprComponentsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -225,7 +225,7 @@ func (client *DaprComponentsClient) getHandleResponse(resp *http.Response) (Dapr // NewListPager - Get the Dapr Components for a managed environment. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - options - DaprComponentsClientListOptions contains the optional parameters for the DaprComponentsClient.NewListPager method. @@ -277,7 +277,7 @@ func (client *DaprComponentsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +295,7 @@ func (client *DaprComponentsClient) listHandleResponse(resp *http.Response) (Dap // ListSecrets - List secrets for a dapr component // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - componentName - Name of the Dapr Component. @@ -340,7 +340,7 @@ func (client *DaprComponentsClient) listSecretsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client_example_test.go index 8a23aea3967d..1b10edcd030d 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_List.json func ExampleDaprComponentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -76,13 +76,129 @@ func ExampleDaprComponentsClient_NewListPager() { // }}, // Version: to.Ptr("v1"), // }, - // }}, - // } + // }, + // { + // Name: to.Ptr("vaultdog"), + // Type: to.Ptr("Microsoft.App/managedEnvironments/daprcomponents"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprcomponents/vaultdog"), + // Properties: &armappcontainers.DaprComponentProperties{ + // ComponentType: to.Ptr("state.azure.cosmosdb"), + // IgnoreErrors: to.Ptr(false), + // InitTimeout: to.Ptr("50s"), + // Metadata: []*armappcontainers.DaprMetadata{ + // { + // Name: to.Ptr("url"), + // Value: to.Ptr(""), + // }, + // { + // Name: to.Ptr("database"), + // Value: to.Ptr("itemsDB"), + // }, + // { + // Name: to.Ptr("collection"), + // Value: to.Ptr("items"), + // }, + // { + // Name: to.Ptr("masterkey"), + // SecretRef: to.Ptr("masterkey"), + // }}, + // Scopes: []*string{ + // to.Ptr("container-app-1"), + // to.Ptr("container-app-2")}, + // SecretStoreComponent: to.Ptr("my-secret-store"), + // Version: to.Ptr("v1"), + // }, + // }, + // { + // Name: to.Ptr("vaultdog"), + // Type: to.Ptr("Microsoft.App/managedEnvironments/daprcomponents"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprcomponents/vaultdog"), + // Properties: &armappcontainers.DaprComponentProperties{ + // ComponentType: to.Ptr("state.azure.cosmosdb"), + // IgnoreErrors: to.Ptr(false), + // InitTimeout: to.Ptr("50s"), + // Metadata: []*armappcontainers.DaprMetadata{ + // { + // Name: to.Ptr("url"), + // SecretRef: to.Ptr("cosmosdb/url"), + // }, + // { + // Name: to.Ptr("database"), + // Value: to.Ptr("itemsDB"), + // }, + // { + // Name: to.Ptr("collection"), + // Value: to.Ptr("items"), + // }, + // { + // Name: to.Ptr("masterkey"), + // SecretRef: to.Ptr("cosmosdb/masterkey"), + // }}, + // Scopes: []*string{ + // to.Ptr("container-app-1"), + // to.Ptr("container-app-2")}, + // SecretStoreComponent: to.Ptr("my-secret-store"), + // Version: to.Ptr("v1"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_Get.json -func ExampleDaprComponentsClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_SecretStoreComponent.json +func ExampleDaprComponentsClient_Get_getDaprComponentWithSecretStoreComponent() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDaprComponentsClient().Get(ctx, "examplerg", "myenvironment", "reddog", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DaprComponent = armappcontainers.DaprComponent{ + // Name: to.Ptr("reddog"), + // Type: to.Ptr("Microsoft.App/managedEnvironments/daprcomponents"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/jlaw-demo1/daprcomponents/reddog"), + // Properties: &armappcontainers.DaprComponentProperties{ + // ComponentType: to.Ptr("state.azure.cosmosdb"), + // IgnoreErrors: to.Ptr(false), + // InitTimeout: to.Ptr("50s"), + // Metadata: []*armappcontainers.DaprMetadata{ + // { + // Name: to.Ptr("url"), + // Value: to.Ptr(""), + // }, + // { + // Name: to.Ptr("database"), + // Value: to.Ptr("itemsDB"), + // }, + // { + // Name: to.Ptr("collection"), + // Value: to.Ptr("items"), + // }, + // { + // Name: to.Ptr("masterkey"), + // SecretRef: to.Ptr("masterkey"), + // }}, + // Scopes: []*string{ + // to.Ptr("container-app-1"), + // to.Ptr("container-app-2")}, + // SecretStoreComponent: to.Ptr("my-secret-store"), + // Version: to.Ptr("v1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_Secrets.json +func ExampleDaprComponentsClient_Get_getDaprComponentWithSecrets() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -136,8 +252,88 @@ func ExampleDaprComponentsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_CreateOrUpdate.json -func ExampleDaprComponentsClient_CreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +func ExampleDaprComponentsClient_CreateOrUpdate_createOrUpdateDaprComponentWithSecretStoreComponent() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDaprComponentsClient().CreateOrUpdate(ctx, "examplerg", "myenvironment", "reddog", armappcontainers.DaprComponent{ + Properties: &armappcontainers.DaprComponentProperties{ + ComponentType: to.Ptr("state.azure.cosmosdb"), + IgnoreErrors: to.Ptr(false), + InitTimeout: to.Ptr("50s"), + Metadata: []*armappcontainers.DaprMetadata{ + { + Name: to.Ptr("url"), + Value: to.Ptr(""), + }, + { + Name: to.Ptr("database"), + Value: to.Ptr("itemsDB"), + }, + { + Name: to.Ptr("collection"), + Value: to.Ptr("items"), + }, + { + Name: to.Ptr("masterkey"), + SecretRef: to.Ptr("masterkey"), + }}, + Scopes: []*string{ + to.Ptr("container-app-1"), + to.Ptr("container-app-2")}, + SecretStoreComponent: to.Ptr("my-secret-store"), + Version: to.Ptr("v1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DaprComponent = armappcontainers.DaprComponent{ + // Name: to.Ptr("reddog"), + // Type: to.Ptr("Microsoft.App/managedEnvironments/daprcomponents"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/jlaw-demo1/daprcomponents/reddog"), + // Properties: &armappcontainers.DaprComponentProperties{ + // ComponentType: to.Ptr("state.azure.cosmosdb"), + // IgnoreErrors: to.Ptr(false), + // InitTimeout: to.Ptr("50s"), + // Metadata: []*armappcontainers.DaprMetadata{ + // { + // Name: to.Ptr("url"), + // Value: to.Ptr(""), + // }, + // { + // Name: to.Ptr("database"), + // Value: to.Ptr("itemsDB"), + // }, + // { + // Name: to.Ptr("collection"), + // Value: to.Ptr("items"), + // }, + // { + // Name: to.Ptr("masterkey"), + // SecretRef: to.Ptr("masterkey"), + // }}, + // Scopes: []*string{ + // to.Ptr("container-app-1"), + // to.Ptr("container-app-2")}, + // SecretStoreComponent: to.Ptr("my-secret-store"), + // Version: to.Ptr("v1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json +func ExampleDaprComponentsClient_CreateOrUpdate_createOrUpdateDaprComponentWithSecrets() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -223,7 +419,7 @@ func ExampleDaprComponentsClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Delete.json func ExampleDaprComponentsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -240,7 +436,7 @@ func ExampleDaprComponentsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_ListSecrets.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_ListSecrets.json func ExampleDaprComponentsClient_ListSecrets() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -259,7 +455,7 @@ func ExampleDaprComponentsClient_ListSecrets() { _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.DaprSecretsCollection = armappcontainers.DaprSecretsCollection{ - // Value: []*armappcontainers.Secret{ + // Value: []*armappcontainers.DaprSecret{ // { // Name: to.Ptr("secret1"), // }, diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/go.mod b/sdk/resourcemanager/appcontainers/armappcontainers/go.mod index 5298666e65e1..10ebb376c6ad 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/go.mod +++ b/sdk/resourcemanager/appcontainers/armappcontainers/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2 go 1.18 diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go new file mode 100644 index 000000000000..67e9f6150c39 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go @@ -0,0 +1,689 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// JobsClient contains the methods for the Jobs group. +// Don't use this type directly, use NewJobsClient() instead. +type JobsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewJobsClient creates a new instance of JobsClient 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 NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { + cl, err := arm.NewClient(moduleName+".JobsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &JobsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or Update a Container Apps Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - jobEnvelope - Properties used to create a container apps job +// - options - JobsClientBeginCreateOrUpdateOptions contains the optional parameters for the JobsClient.BeginCreateOrUpdate +// method. +func (client *JobsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope Job, options *JobsClientBeginCreateOrUpdateOptions) (*runtime.Poller[JobsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, jobName, jobEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JobsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[JobsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create or Update a Container Apps Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *JobsClient) createOrUpdate(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope Job, options *JobsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, jobName, jobEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().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 *JobsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope Job, options *JobsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" + 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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, jobEnvelope) +} + +// BeginDelete - Delete a Container Apps Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - options - JobsClientBeginDeleteOptions contains the optional parameters for the JobsClient.BeginDelete method. +func (client *JobsClient) BeginDelete(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginDeleteOptions) (*runtime.Poller[JobsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JobsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[JobsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a Container Apps Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *JobsClient) deleteOperation(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().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 *JobsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" + 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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the properties of a Container Apps Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +func (client *JobsClient) Get(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientGetOptions) (JobsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return JobsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return JobsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" + 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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetResponse, error) { + result := JobsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { + return JobsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get the Container Apps Jobs in a given resource group. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.NewListByResourceGroupPager +// method. +func (client *JobsClient) NewListByResourceGroupPager(resourceGroupName string, options *JobsClientListByResourceGroupOptions) *runtime.Pager[JobsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[JobsClientListByResourceGroupResponse]{ + More: func(page JobsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *JobsClientListByResourceGroupResponse) (JobsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return JobsClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return JobsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *JobsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *JobsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *JobsClient) listByResourceGroupHandleResponse(resp *http.Response) (JobsClientListByResourceGroupResponse, error) { + result := JobsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobsCollection); err != nil { + return JobsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get the Container Apps Jobs in a given subscription. +// +// Generated from API version 2022-11-01-preview +// - options - JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.NewListBySubscriptionPager +// method. +func (client *JobsClient) NewListBySubscriptionPager(options *JobsClientListBySubscriptionOptions) *runtime.Pager[JobsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[JobsClientListBySubscriptionResponse]{ + More: func(page JobsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *JobsClientListBySubscriptionResponse) (JobsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return JobsClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return JobsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *JobsClient) listBySubscriptionCreateRequest(ctx context.Context, options *JobsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/jobs" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *JobsClient) listBySubscriptionHandleResponse(resp *http.Response) (JobsClientListBySubscriptionResponse, error) { + result := JobsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobsCollection); err != nil { + return JobsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// ListSecrets - List secrets for a container apps job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - options - JobsClientListSecretsOptions contains the optional parameters for the JobsClient.ListSecrets method. +func (client *JobsClient) ListSecrets(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientListSecretsOptions) (JobsClientListSecretsResponse, error) { + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return JobsClientListSecretsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return JobsClientListSecretsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientListSecretsResponse{}, runtime.NewResponseError(resp) + } + return client.listSecretsHandleResponse(resp) +} + +// listSecretsCreateRequest creates the ListSecrets request. +func (client *JobsClient) listSecretsCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecretsHandleResponse handles the ListSecrets response. +func (client *JobsClient) listSecretsHandleResponse(resp *http.Response) (JobsClientListSecretsResponse, error) { + result := JobsClientListSecretsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobSecretsCollection); err != nil { + return JobsClientListSecretsResponse{}, err + } + return result, nil +} + +// BeginStart - Start a Container Apps Job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - templateParam - Properties used to start a job instance. +// - options - JobsClientBeginStartOptions contains the optional parameters for the JobsClient.BeginStart method. +func (client *JobsClient) BeginStart(ctx context.Context, resourceGroupName string, jobName string, templateParam JobExecutionTemplate, options *JobsClientBeginStartOptions) (*runtime.Poller[JobsClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, jobName, templateParam, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JobsClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[JobsClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Start - Start a Container Apps Job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *JobsClient) start(ctx context.Context, resourceGroupName string, jobName string, templateParam JobExecutionTemplate, options *JobsClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, jobName, templateParam, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *JobsClient) startCreateRequest(ctx context.Context, resourceGroupName string, jobName string, templateParam JobExecutionTemplate, options *JobsClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start" + 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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, templateParam) +} + +// BeginStopExecution - Terminates execution of a running container apps job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - jobExecutionName - Job execution name. +// - options - JobsClientBeginStopExecutionOptions contains the optional parameters for the JobsClient.BeginStopExecution method. +func (client *JobsClient) BeginStopExecution(ctx context.Context, resourceGroupName string, jobName string, jobExecutionName string, options *JobsClientBeginStopExecutionOptions) (*runtime.Poller[JobsClientStopExecutionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stopExecution(ctx, resourceGroupName, jobName, jobExecutionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JobsClientStopExecutionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[JobsClientStopExecutionResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// StopExecution - Terminates execution of a running container apps job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *JobsClient) stopExecution(ctx context.Context, resourceGroupName string, jobName string, jobExecutionName string, options *JobsClientBeginStopExecutionOptions) (*http.Response, error) { + req, err := client.stopExecutionCreateRequest(ctx, resourceGroupName, jobName, jobExecutionName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopExecutionCreateRequest creates the StopExecution request. +func (client *JobsClient) stopExecutionCreateRequest(ctx context.Context, resourceGroupName string, jobName string, jobExecutionName string, options *JobsClientBeginStopExecutionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop" + 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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if jobExecutionName == "" { + return nil, errors.New("parameter jobExecutionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobExecutionName}", url.PathEscape(jobExecutionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStopMultipleExecutions - Terminates execution of a running container apps job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - jobExecutionName - List of all job executions that should be stopped. +// - options - JobsClientBeginStopMultipleExecutionsOptions contains the optional parameters for the JobsClient.BeginStopMultipleExecutions +// method. +func (client *JobsClient) BeginStopMultipleExecutions(ctx context.Context, resourceGroupName string, jobName string, jobExecutionName JobExecutionNamesCollection, options *JobsClientBeginStopMultipleExecutionsOptions) (*runtime.Poller[JobsClientStopMultipleExecutionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stopMultipleExecutions(ctx, resourceGroupName, jobName, jobExecutionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JobsClientStopMultipleExecutionsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[JobsClientStopMultipleExecutionsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// StopMultipleExecutions - Terminates execution of a running container apps job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *JobsClient) stopMultipleExecutions(ctx context.Context, resourceGroupName string, jobName string, jobExecutionName JobExecutionNamesCollection, options *JobsClientBeginStopMultipleExecutionsOptions) (*http.Response, error) { + req, err := client.stopMultipleExecutionsCreateRequest(ctx, resourceGroupName, jobName, jobExecutionName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopMultipleExecutionsCreateRequest creates the StopMultipleExecutions request. +func (client *JobsClient) stopMultipleExecutionsCreateRequest(ctx context.Context, resourceGroupName string, jobName string, jobExecutionName JobExecutionNamesCollection, options *JobsClientBeginStopMultipleExecutionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop" + 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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, jobExecutionName) +} + +// BeginUpdate - Patches a Container Apps Job using JSON Merge Patch +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - jobEnvelope - Properties used to create a container apps job +// - options - JobsClientBeginUpdateOptions contains the optional parameters for the JobsClient.BeginUpdate method. +func (client *JobsClient) BeginUpdate(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope JobPatchProperties, options *JobsClientBeginUpdateOptions) (*runtime.Poller[JobsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, jobName, jobEnvelope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[JobsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[JobsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - Patches a Container Apps Job using JSON Merge Patch +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *JobsClient) update(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope JobPatchProperties, options *JobsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, jobName, jobEnvelope, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *JobsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope JobPatchProperties, options *JobsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" + 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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, jobEnvelope) +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go new file mode 100644 index 000000000000..df60cb227c03 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go @@ -0,0 +1,716 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListBySubscription.json +func ExampleJobsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewJobsClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.JobsCollection = armappcontainers.JobsCollection{ + // Value: []*armappcontainers.Job{ + // { + // Name: to.Ptr("testcontainerAppsJob0"), + // Type: to.Ptr("Microsoft.App/jobs"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob0"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.JobProperties{ + // Configuration: &armappcontainers.JobConfiguration{ + // ManualTriggerConfig: &armappcontainers.JobConfigurationManualTriggerConfig{ + // Parallelism: to.Ptr[int32](4), + // ReplicaCompletionCount: to.Ptr[int32](1), + // }, + // ReplicaRetryLimit: to.Ptr[int32](10), + // ReplicaTimeout: to.Ptr[int32](10), + // TriggerType: to.Ptr(armappcontainers.TriggerTypeManual), + // }, + // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.JobProvisioningStateSucceeded), + // Template: &armappcontainers.JobTemplate{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // }, + // }, + // }, + // { + // Name: to.Ptr("testcontainerAppsJob1"), + // Type: to.Ptr("Microsoft.App/jobs"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob1"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.JobProperties{ + // Configuration: &armappcontainers.JobConfiguration{ + // ReplicaRetryLimit: to.Ptr[int32](10), + // ReplicaTimeout: to.Ptr[int32](10), + // ScheduleTriggerConfig: &armappcontainers.JobConfigurationScheduleTriggerConfig{ + // CronExpression: to.Ptr("* * * * 5"), + // Parallelism: to.Ptr[int32](5), + // ReplicaCompletionCount: to.Ptr[int32](1), + // }, + // TriggerType: to.Ptr(armappcontainers.TriggerTypeScheduled), + // }, + // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.JobProvisioningStateSucceeded), + // Template: &armappcontainers.JobTemplate{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerAppsJob1"), + // Image: to.Ptr("repo/testcontainerAppsJob1:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerAppsJob1"), + // Image: to.Ptr("repo/testcontainerAppsJob1:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListByResourceGroup.json +func ExampleJobsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewJobsClient().NewListByResourceGroupPager("rg", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.JobsCollection = armappcontainers.JobsCollection{ + // Value: []*armappcontainers.Job{ + // { + // Name: to.Ptr("testcontainerAppsJob0"), + // Type: to.Ptr("Microsoft.App/jobs"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob0"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.JobProperties{ + // Configuration: &armappcontainers.JobConfiguration{ + // ManualTriggerConfig: &armappcontainers.JobConfigurationManualTriggerConfig{ + // Parallelism: to.Ptr[int32](4), + // ReplicaCompletionCount: to.Ptr[int32](1), + // }, + // ReplicaRetryLimit: to.Ptr[int32](10), + // ReplicaTimeout: to.Ptr[int32](10), + // TriggerType: to.Ptr(armappcontainers.TriggerTypeManual), + // }, + // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.JobProvisioningStateSucceeded), + // Template: &armappcontainers.JobTemplate{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // }, + // }, + // }, + // { + // Name: to.Ptr("testcontainerAppsJob1"), + // Type: to.Ptr("Microsoft.App/jobs"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob1"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.JobProperties{ + // Configuration: &armappcontainers.JobConfiguration{ + // ReplicaRetryLimit: to.Ptr[int32](10), + // ReplicaTimeout: to.Ptr[int32](10), + // ScheduleTriggerConfig: &armappcontainers.JobConfigurationScheduleTriggerConfig{ + // CronExpression: to.Ptr("* * * * 5"), + // Parallelism: to.Ptr[int32](4), + // ReplicaCompletionCount: to.Ptr[int32](1), + // }, + // TriggerType: to.Ptr(armappcontainers.TriggerTypeScheduled), + // }, + // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.JobProvisioningStateSucceeded), + // Template: &armappcontainers.JobTemplate{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerAppsJob1:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerApp0"), + // Image: to.Ptr("repo/testinitcontainerAppsJob1:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Get.json +func ExampleJobsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewJobsClient().Get(ctx, "rg", "testcontainerAppsJob0", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Job = armappcontainers.Job{ + // Name: to.Ptr("testcontainerAppsJob0"), + // Type: to.Ptr("Microsoft.App/jobs"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob0"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.JobProperties{ + // Configuration: &armappcontainers.JobConfiguration{ + // ManualTriggerConfig: &armappcontainers.JobConfigurationManualTriggerConfig{ + // Parallelism: to.Ptr[int32](4), + // ReplicaCompletionCount: to.Ptr[int32](1), + // }, + // ReplicaRetryLimit: to.Ptr[int32](10), + // ReplicaTimeout: to.Ptr[int32](10), + // TriggerType: to.Ptr(armappcontainers.TriggerTypeManual), + // }, + // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.JobProvisioningStateSucceeded), + // Template: &armappcontainers.JobTemplate{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_CreateorUpdate.json +func ExampleJobsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewJobsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerAppsJob0", armappcontainers.Job{ + Location: to.Ptr("East US"), + Properties: &armappcontainers.JobProperties{ + Configuration: &armappcontainers.JobConfiguration{ + ManualTriggerConfig: &armappcontainers.JobConfigurationManualTriggerConfig{ + Parallelism: to.Ptr[int32](4), + ReplicaCompletionCount: to.Ptr[int32](1), + }, + ReplicaRetryLimit: to.Ptr[int32](10), + ReplicaTimeout: to.Ptr[int32](10), + TriggerType: to.Ptr(armappcontainers.TriggerTypeManual), + }, + EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + Template: &armappcontainers.JobTemplate{ + Containers: []*armappcontainers.Container{ + { + Name: to.Ptr("testcontainerAppsJob0"), + Image: to.Ptr("repo/testcontainerAppsJob0:v1"), + Probes: []*armappcontainers.ContainerAppProbe{ + { + Type: to.Ptr(armappcontainers.TypeLiveness), + HTTPGet: &armappcontainers.ContainerAppProbeHTTPGet{ + Path: to.Ptr("/health"), + HTTPHeaders: []*armappcontainers.ContainerAppProbeHTTPGetHTTPHeadersItem{ + { + Name: to.Ptr("Custom-Header"), + Value: to.Ptr("Awesome"), + }}, + Port: to.Ptr[int32](8080), + }, + InitialDelaySeconds: to.Ptr[int32](5), + PeriodSeconds: to.Ptr[int32](3), + }}, + }}, + InitContainers: []*armappcontainers.InitContainer{ + { + Name: to.Ptr("testinitcontainerAppsJob0"), + Args: []*string{ + to.Ptr("-c"), + to.Ptr("while true; do echo hello; sleep 10;done")}, + Command: []*string{ + to.Ptr("/bin/sh")}, + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + Resources: &armappcontainers.ContainerResources{ + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), + }, + }}, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Job = armappcontainers.Job{ + // Name: to.Ptr("testcontainerAppsJob0"), + // Type: to.Ptr("Microsoft.App/jobs"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob0"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.JobProperties{ + // Configuration: &armappcontainers.JobConfiguration{ + // ManualTriggerConfig: &armappcontainers.JobConfigurationManualTriggerConfig{ + // Parallelism: to.Ptr[int32](4), + // ReplicaCompletionCount: to.Ptr[int32](1), + // }, + // ReplicaRetryLimit: to.Ptr[int32](10), + // ReplicaTimeout: to.Ptr[int32](10), + // TriggerType: to.Ptr(armappcontainers.TriggerTypeManual), + // }, + // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // ProvisioningState: to.Ptr(armappcontainers.JobProvisioningStateSucceeded), + // Template: &armappcontainers.JobTemplate{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // Probes: []*armappcontainers.ContainerAppProbe{ + // { + // Type: to.Ptr(armappcontainers.TypeLiveness), + // HTTPGet: &armappcontainers.ContainerAppProbeHTTPGet{ + // Path: to.Ptr("/health"), + // HTTPHeaders: []*armappcontainers.ContainerAppProbeHTTPGetHTTPHeadersItem{ + // { + // Name: to.Ptr("Custom-Header"), + // Value: to.Ptr("Awesome"), + // }}, + // Port: to.Ptr[int32](8080), + // }, + // InitialDelaySeconds: to.Ptr[int32](3), + // PeriodSeconds: to.Ptr[int32](3), + // }}, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerAppsJob0"), + // Args: []*string{ + // to.Ptr("-c"), + // to.Ptr("while true; do echo hello; sleep 10;done")}, + // Command: []*string{ + // to.Ptr("/bin/sh")}, + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Delete.json +func ExampleJobsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewJobsClient().BeginDelete(ctx, "rg", "testWorkerContainerAppsJob0", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Patch.json +func ExampleJobsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewJobsClient().BeginUpdate(ctx, "rg", "testcontainerAppsJob0", armappcontainers.JobPatchProperties{ + Properties: &armappcontainers.JobPatchPropertiesProperties{ + Configuration: &armappcontainers.JobConfiguration{ + ManualTriggerConfig: &armappcontainers.JobConfigurationManualTriggerConfig{ + Parallelism: to.Ptr[int32](4), + ReplicaCompletionCount: to.Ptr[int32](1), + }, + ReplicaRetryLimit: to.Ptr[int32](10), + ReplicaTimeout: to.Ptr[int32](10), + TriggerType: to.Ptr(armappcontainers.TriggerTypeManual), + }, + Template: &armappcontainers.JobTemplate{ + Containers: []*armappcontainers.Container{ + { + Name: to.Ptr("testcontainerAppsJob0"), + Image: to.Ptr("repo/testcontainerAppsJob0:v1"), + Probes: []*armappcontainers.ContainerAppProbe{ + { + Type: to.Ptr(armappcontainers.TypeLiveness), + HTTPGet: &armappcontainers.ContainerAppProbeHTTPGet{ + Path: to.Ptr("/health"), + HTTPHeaders: []*armappcontainers.ContainerAppProbeHTTPGetHTTPHeadersItem{ + { + Name: to.Ptr("Custom-Header"), + Value: to.Ptr("Awesome"), + }}, + Port: to.Ptr[int32](8080), + }, + InitialDelaySeconds: to.Ptr[int32](3), + PeriodSeconds: to.Ptr[int32](3), + }}, + }}, + InitContainers: []*armappcontainers.InitContainer{ + { + Name: to.Ptr("testinitcontainerAppsJob0"), + Args: []*string{ + to.Ptr("-c"), + to.Ptr("while true; do echo hello; sleep 10;done")}, + Command: []*string{ + to.Ptr("/bin/sh")}, + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + Resources: &armappcontainers.ContainerResources{ + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), + }, + }}, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Job = armappcontainers.Job{ + // Name: to.Ptr("testcontainerAppsJob0"), + // Type: to.Ptr("Microsoft.App/jobs"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerAppsJob0"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.JobProperties{ + // Configuration: &armappcontainers.JobConfiguration{ + // ManualTriggerConfig: &armappcontainers.JobConfigurationManualTriggerConfig{ + // Parallelism: to.Ptr[int32](4), + // ReplicaCompletionCount: to.Ptr[int32](1), + // }, + // ReplicaRetryLimit: to.Ptr[int32](10), + // ReplicaTimeout: to.Ptr[int32](10), + // TriggerType: to.Ptr(armappcontainers.TriggerTypeManual), + // }, + // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), + // ProvisioningState: to.Ptr(armappcontainers.JobProvisioningStateSucceeded), + // Template: &armappcontainers.JobTemplate{ + // Containers: []*armappcontainers.Container{ + // { + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.InitContainer{ + // { + // Name: to.Ptr("testinitcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Start.json +func ExampleJobsClient_BeginStart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewJobsClient().BeginStart(ctx, "rg", "testcontainerAppsJob0", armappcontainers.JobExecutionTemplate{ + Containers: []*armappcontainers.JobExecutionContainer{ + { + Name: to.Ptr("testcontainerAppsJob0"), + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + Resources: &armappcontainers.ContainerResources{ + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), + }, + }}, + InitContainers: []*armappcontainers.JobExecutionContainer{ + { + Name: to.Ptr("testinitcontainerAppsJob0"), + Args: []*string{ + to.Ptr("-c"), + to.Ptr("while true; do echo hello; sleep 10;done")}, + Command: []*string{ + to.Ptr("/bin/sh")}, + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + Resources: &armappcontainers.ContainerResources{ + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), + }, + }}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.JobExecutionBase = armappcontainers.JobExecutionBase{ + // Name: to.Ptr("testcontainerAppsJob0-pjxhsye"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/{containerAppsJobName}/executions/{jobExecutionName}"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Execution.json +func ExampleJobsClient_BeginStopExecution() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewJobsClient().BeginStopExecution(ctx, "rg", "testcontainerAppsJob0", "jobExecution1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Multiple.json +func ExampleJobsClient_BeginStopMultipleExecutions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewJobsClient().BeginStopMultipleExecutions(ctx, "rg", "testcontainerAppsJob0", armappcontainers.JobExecutionNamesCollection{ + Value: []*armappcontainers.JobExecutionBase{ + { + Name: to.Ptr("jobExecution-27944453"), + }, + { + Name: to.Ptr("jobExecution-27944452"), + }, + { + Name: to.Ptr("jobExecution-27944451"), + }}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContainerAppJobExecutions = armappcontainers.ContainerAppJobExecutions{ + // Value: []*armappcontainers.JobExecution{ + // { + // Name: to.Ptr("jobExecution-27944453"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:47:30+00:00"); return t}()), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:37:30+00:00"); return t}()), + // Status: to.Ptr(armappcontainers.JobExecutionRunningStateStopped), + // }, + // { + // Name: to.Ptr("jobExecution-27944452"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:47:30+00:00"); return t}()), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:37:30+00:00"); return t}()), + // Status: to.Ptr(armappcontainers.JobExecutionRunningStateStopped), + // }, + // { + // Name: to.Ptr("jobExecution-27944453"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:47:30+00:00"); return t}()), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:37:30+00:00"); return t}()), + // Status: to.Ptr(armappcontainers.JobExecutionRunningStateFailed), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_ListSecrets.json +func ExampleJobsClient_ListSecrets() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewJobsClient().ListSecrets(ctx, "rg", "testcontainerAppsJob0", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.JobSecretsCollection = armappcontainers.JobSecretsCollection{ + // Value: []*armappcontainers.Secret{ + // { + // Name: to.Ptr("secret1"), + // }, + // { + // Name: to.Ptr("secret2"), + // }}, + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go new file mode 100644 index 000000000000..9c494a70087b --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go @@ -0,0 +1,117 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// JobsExecutionsClient contains the methods for the JobsExecutions group. +// Don't use this type directly, use NewJobsExecutionsClient() instead. +type JobsExecutionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewJobsExecutionsClient creates a new instance of JobsExecutionsClient 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 NewJobsExecutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsExecutionsClient, error) { + cl, err := arm.NewClient(moduleName+".JobsExecutionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &JobsExecutionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get a Container Apps Job's executions +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - jobName - Name of the Container Apps Job. +// - options - JobsExecutionsClientListOptions contains the optional parameters for the JobsExecutionsClient.NewListPager method. +func (client *JobsExecutionsClient) NewListPager(resourceGroupName string, jobName string, options *JobsExecutionsClientListOptions) *runtime.Pager[JobsExecutionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[JobsExecutionsClientListResponse]{ + More: func(page JobsExecutionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *JobsExecutionsClientListResponse) (JobsExecutionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, jobName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return JobsExecutionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return JobsExecutionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsExecutionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *JobsExecutionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *JobsExecutionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions" + 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 jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *JobsExecutionsClient) listHandleResponse(resp *http.Response) (JobsExecutionsClientListResponse, error) { + result := JobsExecutionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerAppJobExecutions); err != nil { + return JobsExecutionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go new file mode 100644 index 000000000000..af06540633f3 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go @@ -0,0 +1,77 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Executions_Get.json +func ExampleJobsExecutionsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewJobsExecutionsClient().NewListPager("rg", "testcontainerAppsJob0", &armappcontainers.JobsExecutionsClientListOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ContainerAppJobExecutions = armappcontainers.ContainerAppJobExecutions{ + // Value: []*armappcontainers.JobExecution{ + // { + // Name: to.Ptr("testcontainerAppJob-27944454"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:47:30+00:00"); return t}()), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:37:30+00:00"); return t}()), + // Status: to.Ptr(armappcontainers.JobExecutionRunningStateRunning), + // Template: &armappcontainers.JobExecutionTemplate{ + // Containers: []*armappcontainers.JobExecutionContainer{ + // { + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // InitContainers: []*armappcontainers.JobExecutionContainer{ + // { + // Name: to.Ptr("testinitcontainerAppsJob0"), + // Args: []*string{ + // to.Ptr("-c"), + // to.Ptr("while true; do echo hello; sleep 10;done")}, + // Command: []*string{ + // to.Ptr("/bin/sh")}, + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), + // Resources: &armappcontainers.ContainerResources{ + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), + // }, + // }}, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go new file mode 100644 index 000000000000..b8aa740323b2 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go @@ -0,0 +1,370 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedCertificatesClient contains the methods for the ManagedCertificates group. +// Don't use this type directly, use NewManagedCertificatesClient() instead. +type ManagedCertificatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedCertificatesClient creates a new instance of ManagedCertificatesClient 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 NewManagedCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedCertificatesClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedCertificatesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedCertificatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or Update a Managed Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - managedCertificateName - Name of the Managed Certificate. +// - options - ManagedCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedCertificatesClient.BeginCreateOrUpdate +// method. +func (client *ManagedCertificatesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, options *ManagedCertificatesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedCertificatesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, environmentName, managedCertificateName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedCertificatesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ManagedCertificatesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create or Update a Managed Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, options *ManagedCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, managedCertificateName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().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 *ManagedCertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, options *ManagedCertificatesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" + 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 managedCertificateName == "" { + return nil, errors.New("parameter managedCertificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedCertificateName}", url.PathEscape(managedCertificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ManagedCertificateEnvelope != nil { + return req, runtime.MarshalAsJSON(req, *options.ManagedCertificateEnvelope) + } + return req, nil +} + +// Delete - Deletes the specified Managed Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - managedCertificateName - Name of the Managed Certificate. +// - options - ManagedCertificatesClientDeleteOptions contains the optional parameters for the ManagedCertificatesClient.Delete +// method. +func (client *ManagedCertificatesClient) Delete(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, options *ManagedCertificatesClientDeleteOptions) (ManagedCertificatesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, managedCertificateName, options) + if err != nil { + return ManagedCertificatesClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedCertificatesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ManagedCertificatesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ManagedCertificatesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, options *ManagedCertificatesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" + 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 managedCertificateName == "" { + return nil, errors.New("parameter managedCertificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedCertificateName}", url.PathEscape(managedCertificateName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified Managed Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - managedCertificateName - Name of the Managed Certificate. +// - options - ManagedCertificatesClientGetOptions contains the optional parameters for the ManagedCertificatesClient.Get method. +func (client *ManagedCertificatesClient) Get(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, options *ManagedCertificatesClientGetOptions) (ManagedCertificatesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, environmentName, managedCertificateName, options) + if err != nil { + return ManagedCertificatesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedCertificatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedCertificatesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ManagedCertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, options *ManagedCertificatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" + 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 managedCertificateName == "" { + return nil, errors.New("parameter managedCertificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedCertificateName}", url.PathEscape(managedCertificateName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedCertificatesClient) getHandleResponse(resp *http.Response) (ManagedCertificatesClientGetResponse, error) { + result := ManagedCertificatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedCertificate); err != nil { + return ManagedCertificatesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Managed Certificates in a given managed environment. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - options - ManagedCertificatesClientListOptions contains the optional parameters for the ManagedCertificatesClient.NewListPager +// method. +func (client *ManagedCertificatesClient) NewListPager(resourceGroupName string, environmentName string, options *ManagedCertificatesClientListOptions) *runtime.Pager[ManagedCertificatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedCertificatesClientListResponse]{ + More: func(page ManagedCertificatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedCertificatesClientListResponse) (ManagedCertificatesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, environmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedCertificatesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedCertificatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedCertificatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedCertificatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedCertificatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagedCertificatesClient) listHandleResponse(resp *http.Response) (ManagedCertificatesClientListResponse, error) { + result := ManagedCertificatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedCertificateCollection); err != nil { + return ManagedCertificatesClientListResponse{}, err + } + return result, nil +} + +// Update - Patches a managed certificate. Oly patching of tags is supported +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - managedCertificateName - Name of the Managed Certificate. +// - managedCertificateEnvelope - Properties of a managed certificate that need to be updated +// - options - ManagedCertificatesClientUpdateOptions contains the optional parameters for the ManagedCertificatesClient.Update +// method. +func (client *ManagedCertificatesClient) Update(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, managedCertificateEnvelope ManagedCertificatePatch, options *ManagedCertificatesClientUpdateOptions) (ManagedCertificatesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, environmentName, managedCertificateName, managedCertificateEnvelope, options) + if err != nil { + return ManagedCertificatesClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedCertificatesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedCertificatesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ManagedCertificatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, managedCertificateEnvelope ManagedCertificatePatch, options *ManagedCertificatesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" + 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 managedCertificateName == "" { + return nil, errors.New("parameter managedCertificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedCertificateName}", url.PathEscape(managedCertificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, managedCertificateEnvelope) +} + +// updateHandleResponse handles the Update response. +func (client *ManagedCertificatesClient) updateHandleResponse(resp *http.Response) (ManagedCertificatesClientUpdateResponse, error) { + result := ManagedCertificatesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedCertificate); err != nil { + return ManagedCertificatesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go new file mode 100644 index 000000000000..a83be1aae56e --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go @@ -0,0 +1,200 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Get.json +func ExampleManagedCertificatesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedCertificatesClient().Get(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ManagedCertificate = armappcontainers.ManagedCertificate{ + // Type: to.Ptr("Microsoft.App/ManagedEnvironments/managedCertificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/managedCertificates/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ManagedCertificateProperties{ + // DomainControlValidation: to.Ptr(armappcontainers.ManagedCertificateDomainControlValidationCNAME), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectName: to.Ptr("CN=my-subject-name.company.country.net"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_CreateOrUpdate.json +func ExampleManagedCertificatesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedCertificatesClient().BeginCreateOrUpdate(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", &armappcontainers.ManagedCertificatesClientBeginCreateOrUpdateOptions{ManagedCertificateEnvelope: &armappcontainers.ManagedCertificate{ + Location: to.Ptr("East US"), + Properties: &armappcontainers.ManagedCertificateProperties{ + DomainControlValidation: to.Ptr(armappcontainers.ManagedCertificateDomainControlValidationCNAME), + SubjectName: to.Ptr("my-subject-name.company.country.net"), + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ManagedCertificate = armappcontainers.ManagedCertificate{ + // Type: to.Ptr("Microsoft.App/ManagedEnvironments/managedCertificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/managedCertificates/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ManagedCertificateProperties{ + // DomainControlValidation: to.Ptr(armappcontainers.ManagedCertificateDomainControlValidationCNAME), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectName: to.Ptr("CN=my-subject-name.company.country.net"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Delete.json +func ExampleManagedCertificatesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewManagedCertificatesClient().Delete(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_Patch.json +func ExampleManagedCertificatesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedCertificatesClient().Update(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", armappcontainers.ManagedCertificatePatch{ + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ManagedCertificate = armappcontainers.ManagedCertificate{ + // Type: to.Ptr("Microsoft.App/ManagedEnvironments/managedCertificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/managedCertificates/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ManagedCertificateProperties{ + // DomainControlValidation: to.Ptr(armappcontainers.ManagedCertificateDomainControlValidationCNAME), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectName: to.Ptr("CN=my-subject-name.company.country.net"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_ListByManagedEnvironment.json +func ExampleManagedCertificatesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedCertificatesClient().NewListPager("examplerg", "testcontainerenv", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ManagedCertificateCollection = armappcontainers.ManagedCertificateCollection{ + // Value: []*armappcontainers.ManagedCertificate{ + // { + // Type: to.Ptr("Microsoft.App/ManagedEnvironments/managedCertificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/managedCertificates/certificate-firendly-name"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ManagedCertificateProperties{ + // DomainControlValidation: to.Ptr(armappcontainers.ManagedCertificateDomainControlValidationCNAME), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectName: to.Ptr("CN=my-subject-name.company.country.net"), + // }, + // }, + // { + // Type: to.Ptr("Microsoft.App/ManagedEnvironments/managedCertificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/managedCertificates/certificate-firendly-name-root"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ManagedCertificateProperties{ + // DomainControlValidation: to.Ptr(armappcontainers.ManagedCertificateDomainControlValidationHTTP), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectName: to.Ptr("CN=company.country.net"), + // }, + // }, + // { + // Type: to.Ptr("Microsoft.App/ManagedEnvironments/managedCertificates"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/managedCertificates/certificate-firendly-name-txt"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ManagedCertificateProperties{ + // DomainControlValidation: to.Ptr(armappcontainers.ManagedCertificateDomainControlValidationTXT), + // ProvisioningState: to.Ptr(armappcontainers.CertificateProvisioningStateSucceeded), + // SubjectName: to.Ptr("CN=txt.company.country.net"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go new file mode 100644 index 000000000000..0f8c79eb82a7 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go @@ -0,0 +1,166 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedEnvironmentDiagnosticsClient contains the methods for the ManagedEnvironmentDiagnostics group. +// Don't use this type directly, use NewManagedEnvironmentDiagnosticsClient() instead. +type ManagedEnvironmentDiagnosticsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedEnvironmentDiagnosticsClient creates a new instance of ManagedEnvironmentDiagnosticsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedEnvironmentDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentDiagnosticsClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedEnvironmentDiagnosticsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedEnvironmentDiagnosticsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetDetector - Get the diagnostics data for a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Environment. +// - detectorName - Name of the Managed Environment detector. +// - options - ManagedEnvironmentDiagnosticsClientGetDetectorOptions contains the optional parameters for the ManagedEnvironmentDiagnosticsClient.GetDetector +// method. +func (client *ManagedEnvironmentDiagnosticsClient) GetDetector(ctx context.Context, resourceGroupName string, environmentName string, detectorName string, options *ManagedEnvironmentDiagnosticsClientGetDetectorOptions) (ManagedEnvironmentDiagnosticsClientGetDetectorResponse, error) { + req, err := client.getDetectorCreateRequest(ctx, resourceGroupName, environmentName, detectorName, options) + if err != nil { + return ManagedEnvironmentDiagnosticsClientGetDetectorResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedEnvironmentDiagnosticsClientGetDetectorResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentDiagnosticsClientGetDetectorResponse{}, runtime.NewResponseError(resp) + } + return client.getDetectorHandleResponse(resp) +} + +// getDetectorCreateRequest creates the GetDetector request. +func (client *ManagedEnvironmentDiagnosticsClient) getDetectorCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, detectorName string, options *ManagedEnvironmentDiagnosticsClientGetDetectorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if detectorName == "" { + return nil, errors.New("parameter detectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{detectorName}", url.PathEscape(detectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDetectorHandleResponse handles the GetDetector response. +func (client *ManagedEnvironmentDiagnosticsClient) getDetectorHandleResponse(resp *http.Response) (ManagedEnvironmentDiagnosticsClientGetDetectorResponse, error) { + result := ManagedEnvironmentDiagnosticsClientGetDetectorResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Diagnostics); err != nil { + return ManagedEnvironmentDiagnosticsClientGetDetectorResponse{}, err + } + return result, nil +} + +// ListDetectors - Get the list of diagnostics for a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Environment. +// - options - ManagedEnvironmentDiagnosticsClientListDetectorsOptions contains the optional parameters for the ManagedEnvironmentDiagnosticsClient.ListDetectors +// method. +func (client *ManagedEnvironmentDiagnosticsClient) ListDetectors(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentDiagnosticsClientListDetectorsOptions) (ManagedEnvironmentDiagnosticsClientListDetectorsResponse, error) { + req, err := client.listDetectorsCreateRequest(ctx, resourceGroupName, environmentName, options) + if err != nil { + return ManagedEnvironmentDiagnosticsClientListDetectorsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedEnvironmentDiagnosticsClientListDetectorsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentDiagnosticsClientListDetectorsResponse{}, runtime.NewResponseError(resp) + } + return client.listDetectorsHandleResponse(resp) +} + +// listDetectorsCreateRequest creates the ListDetectors request. +func (client *ManagedEnvironmentDiagnosticsClient) listDetectorsCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentDiagnosticsClientListDetectorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listDetectorsHandleResponse handles the ListDetectors response. +func (client *ManagedEnvironmentDiagnosticsClient) listDetectorsHandleResponse(resp *http.Response) (ManagedEnvironmentDiagnosticsClientListDetectorsResponse, error) { + result := ManagedEnvironmentDiagnosticsClientListDetectorsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticsCollection); err != nil { + return ManagedEnvironmentDiagnosticsClientListDetectorsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go new file mode 100644 index 000000000000..375d14d617a5 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go @@ -0,0 +1,135 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_List.json +func ExampleManagedEnvironmentDiagnosticsClient_ListDetectors() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedEnvironmentDiagnosticsClient().ListDetectors(ctx, "mikono-workerapp-test-rg", "mikonokubeenv", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DiagnosticsCollection = armappcontainers.DiagnosticsCollection{ + // Value: []*armappcontainers.Diagnostics{ + // { + // Name: to.Ptr("ManagedEnvAvailabilityMetrics"), + // Type: to.Ptr("Microsoft.App/managedEnvironments/detectors"), + // ID: to.Ptr("/subscriptions/f07f3711-b45e-40fe-a941-4e6d93f851e6/resourceGroups/mikono-workerapp-test-rg/providers/Microsoft.App/managedEnvironments/mikonokubeenv/detectors/ManagedEnvAvailabilityMetrics"), + // Properties: &armappcontainers.DiagnosticsProperties{ + // Dataset: []*armappcontainers.DiagnosticsDataAPIResponse{ + // }, + // Metadata: &armappcontainers.DiagnosticsDefinition{ + // Name: to.Ptr("Availability Metrics for Managed Environments"), + // Type: to.Ptr("Analysis"), + // Author: to.Ptr(""), + // Category: to.Ptr("Availability and Performance"), + // ID: to.Ptr("ManagedEnvAvailabilityMetrics"), + // Score: to.Ptr[float32](0), + // SupportTopicList: []*armappcontainers.DiagnosticSupportTopic{ + // }, + // }, + // Status: &armappcontainers.DiagnosticsStatus{ + // StatusID: to.Ptr[int32](4), + // }, + // }, + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_Get.json +func ExampleManagedEnvironmentDiagnosticsClient_GetDetector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedEnvironmentDiagnosticsClient().GetDetector(ctx, "mikono-workerapp-test-rg", "mikonokubeenv", "ManagedEnvAvailabilityMetrics", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Diagnostics = armappcontainers.Diagnostics{ + // Name: to.Ptr("ManagedEnvAvailabilityMetrics"), + // Type: to.Ptr("Microsoft.App/managedEnvironments/detectors"), + // ID: to.Ptr("/subscriptions/f07f3711-b45e-40fe-a941-4e6d93f851e6/resourceGroups/mikono-workerapp-test-rg/providers/Microsoft.App/managedEnvironments/mikonokubeenv/detectors/ManagedEnvAvailabilityMetrics"), + // Properties: &armappcontainers.DiagnosticsProperties{ + // Dataset: []*armappcontainers.DiagnosticsDataAPIResponse{ + // { + // RenderingProperties: &armappcontainers.DiagnosticRendering{ + // Type: to.Ptr[int32](8), + // Description: to.Ptr(""), + // IsVisible: to.Ptr(true), + // Title: to.Ptr("Managed Environment Network Inbound "), + // }, + // Table: &armappcontainers.DiagnosticDataTableResponseObject{ + // Columns: []*armappcontainers.DiagnosticDataTableResponseColumn{ + // { + // ColumnName: to.Ptr("TimeStamp"), + // DataType: to.Ptr("DateTime"), + // }, + // { + // ColumnName: to.Ptr("Metric"), + // DataType: to.Ptr("String"), + // }, + // { + // ColumnName: to.Ptr("Average"), + // DataType: to.Ptr("Double"), + // }}, + // Rows: []any{ + // []any{ + // "2022-03-15T21:35:00", + // "RxBytes", + // float64(0), + // }}, + // TableName: to.Ptr(""), + // }, + // }}, + // Metadata: &armappcontainers.DiagnosticsDefinition{ + // Name: to.Ptr("Managed Env Netowrk Inbound and Outbound"), + // Type: to.Ptr("Detector"), + // Description: to.Ptr("This detector shows the Managed Environment Network Inbound and Outbound."), + // Author: to.Ptr(""), + // Category: to.Ptr("Availability and Performance"), + // ID: to.Ptr("ManagedEnvAvailabilityMetrics"), + // Score: to.Ptr[float32](0), + // SupportTopicList: []*armappcontainers.DiagnosticSupportTopic{ + // }, + // }, + // Status: &armappcontainers.DiagnosticsStatus{ + // StatusID: to.Ptr[int32](3), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go index 8975067a2c15..e2f0719158b5 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go @@ -47,7 +47,7 @@ func NewManagedEnvironmentsClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Creates or updates a Managed Environment used to host container apps. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - environmentEnvelope - Configuration details of the Environment. @@ -68,7 +68,7 @@ func (client *ManagedEnvironmentsClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Creates or updates a Managed Environment used to host container apps. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview func (client *ManagedEnvironmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, environmentEnvelope, options) if err != nil { @@ -104,7 +104,7 @@ func (client *ManagedEnvironmentsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, environmentEnvelope) @@ -113,7 +113,7 @@ func (client *ManagedEnvironmentsClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a Managed Environment if it does not have any container apps. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - options - ManagedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginDelete @@ -133,7 +133,7 @@ func (client *ManagedEnvironmentsClient) BeginDelete(ctx context.Context, resour // Delete - Delete a Managed Environment if it does not have any container apps. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview func (client *ManagedEnvironmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, options) if err != nil { @@ -169,7 +169,7 @@ func (client *ManagedEnvironmentsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,7 +178,7 @@ func (client *ManagedEnvironmentsClient) deleteCreateRequest(ctx context.Context // Get - Get the properties of a Managed Environment used to host container apps. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - options - ManagedEnvironmentsClientGetOptions contains the optional parameters for the ManagedEnvironmentsClient.Get method. @@ -217,7 +217,7 @@ func (client *ManagedEnvironmentsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,9 +232,67 @@ func (client *ManagedEnvironmentsClient) getHandleResponse(resp *http.Response) return result, nil } +// GetAuthToken - Checks if resource name is available. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - options - ManagedEnvironmentsClientGetAuthTokenOptions contains the optional parameters for the ManagedEnvironmentsClient.GetAuthToken +// method. +func (client *ManagedEnvironmentsClient) GetAuthToken(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientGetAuthTokenOptions) (ManagedEnvironmentsClientGetAuthTokenResponse, error) { + req, err := client.getAuthTokenCreateRequest(ctx, resourceGroupName, environmentName, options) + if err != nil { + return ManagedEnvironmentsClientGetAuthTokenResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedEnvironmentsClientGetAuthTokenResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsClientGetAuthTokenResponse{}, runtime.NewResponseError(resp) + } + return client.getAuthTokenHandleResponse(resp) +} + +// getAuthTokenCreateRequest creates the GetAuthToken request. +func (client *ManagedEnvironmentsClient) getAuthTokenCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientGetAuthTokenOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAuthTokenHandleResponse handles the GetAuthToken response. +func (client *ManagedEnvironmentsClient) getAuthTokenHandleResponse(resp *http.Response) (ManagedEnvironmentsClientGetAuthTokenResponse, error) { + result := ManagedEnvironmentsClientGetAuthTokenResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnvironmentAuthToken); err != nil { + return ManagedEnvironmentsClientGetAuthTokenResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - Get all the Managed Environments in a resource group. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ManagedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ManagedEnvironmentsClient.NewListByResourceGroupPager // method. @@ -282,7 +340,7 @@ func (client *ManagedEnvironmentsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,7 +357,7 @@ func (client *ManagedEnvironmentsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Get all Managed Environments for a subscription. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - options - ManagedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ManagedEnvironmentsClient.NewListBySubscriptionPager // method. func (client *ManagedEnvironmentsClient) NewListBySubscriptionPager(options *ManagedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ManagedEnvironmentsClientListBySubscriptionResponse] { @@ -342,7 +400,7 @@ func (client *ManagedEnvironmentsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -357,10 +415,80 @@ func (client *ManagedEnvironmentsClient) listBySubscriptionHandleResponse(resp * return result, nil } +// NewListWorkloadProfileStatesPager - Get all workload Profile States for a Managed Environment. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - options - ManagedEnvironmentsClientListWorkloadProfileStatesOptions contains the optional parameters for the ManagedEnvironmentsClient.NewListWorkloadProfileStatesPager +// method. +func (client *ManagedEnvironmentsClient) NewListWorkloadProfileStatesPager(resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientListWorkloadProfileStatesOptions) *runtime.Pager[ManagedEnvironmentsClientListWorkloadProfileStatesResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedEnvironmentsClientListWorkloadProfileStatesResponse]{ + More: func(page ManagedEnvironmentsClientListWorkloadProfileStatesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedEnvironmentsClientListWorkloadProfileStatesResponse) (ManagedEnvironmentsClientListWorkloadProfileStatesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listWorkloadProfileStatesCreateRequest(ctx, resourceGroupName, environmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedEnvironmentsClientListWorkloadProfileStatesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedEnvironmentsClientListWorkloadProfileStatesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsClientListWorkloadProfileStatesResponse{}, runtime.NewResponseError(resp) + } + return client.listWorkloadProfileStatesHandleResponse(resp) + }, + }) +} + +// listWorkloadProfileStatesCreateRequest creates the ListWorkloadProfileStates request. +func (client *ManagedEnvironmentsClient) listWorkloadProfileStatesCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientListWorkloadProfileStatesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listWorkloadProfileStatesHandleResponse handles the ListWorkloadProfileStates response. +func (client *ManagedEnvironmentsClient) listWorkloadProfileStatesHandleResponse(resp *http.Response) (ManagedEnvironmentsClientListWorkloadProfileStatesResponse, error) { + result := ManagedEnvironmentsClientListWorkloadProfileStatesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadProfileStatesCollection); err != nil { + return ManagedEnvironmentsClientListWorkloadProfileStatesResponse{}, err + } + return result, nil +} + // BeginUpdate - Patches a Managed Environment using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - environmentEnvelope - Configuration details of the Environment. @@ -381,7 +509,7 @@ func (client *ManagedEnvironmentsClient) BeginUpdate(ctx context.Context, resour // Update - Patches a Managed Environment using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview func (client *ManagedEnvironmentsClient) update(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, environmentName, environmentEnvelope, options) if err != nil { @@ -391,7 +519,7 @@ func (client *ManagedEnvironmentsClient) update(ctx context.Context, resourceGro if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil @@ -417,7 +545,7 @@ func (client *ManagedEnvironmentsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, environmentEnvelope) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go index 333d2f441f58..d8d471fbd1e9 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironments_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListBySubscription.json func ExampleManagedEnvironmentsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -50,9 +50,44 @@ func ExampleManagedEnvironmentsClient_NewListBySubscriptionPager() { // Tags: map[string]*string{ // }, // Properties: &armappcontainers.ManagedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, // DefaultDomain: to.Ptr("jlaw-demo1.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("capp-svc-jlaw-demo1-northcentralus"), // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), // StaticIP: to.Ptr("20.42.33.145"), + // VnetConfiguration: &armappcontainers.VnetConfiguration{ + // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + // }, + // WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + // { + // Name: to.Ptr("My-GP-01"), + // MaximumCount: to.Ptr[int32](12), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("GeneralPurpose"), + // }, + // { + // Name: to.Ptr("My-MO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("MemoryOptimized"), + // }, + // { + // Name: to.Ptr("My-CO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("ComputeOptimized"), + // }, + // { + // Name: to.Ptr("My-consumption-01"), + // WorkloadProfileType: to.Ptr("Consumption"), + // }}, // ZoneRedundant: to.Ptr(true), // }, // }, @@ -64,9 +99,21 @@ func ExampleManagedEnvironmentsClient_NewListBySubscriptionPager() { // Tags: map[string]*string{ // }, // Properties: &armappcontainers.ManagedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name2.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name2.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, // DefaultDomain: to.Ptr("demo1.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("capp-svc-demo1-northcentralus"), // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), // StaticIP: to.Ptr("52.142.21.61"), + // VnetConfiguration: &armappcontainers.VnetConfiguration{ + // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + // }, // ZoneRedundant: to.Ptr(true), // }, // }}, @@ -74,7 +121,7 @@ func ExampleManagedEnvironmentsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironments_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListByResourceGroup.json func ExampleManagedEnvironmentsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -106,9 +153,44 @@ func ExampleManagedEnvironmentsClient_NewListByResourceGroupPager() { // Tags: map[string]*string{ // }, // Properties: &armappcontainers.ManagedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, // DefaultDomain: to.Ptr("jlaw-demo1.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("capp-svc-jlaw-demo1-northcentralus"), // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), // StaticIP: to.Ptr("20.42.33.145"), + // VnetConfiguration: &armappcontainers.VnetConfiguration{ + // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + // }, + // WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + // { + // Name: to.Ptr("My-GP-01"), + // MaximumCount: to.Ptr[int32](12), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("GeneralPurpose"), + // }, + // { + // Name: to.Ptr("My-MO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("MemoryOptimized"), + // }, + // { + // Name: to.Ptr("My-CO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("ComputeOptimized"), + // }, + // { + // Name: to.Ptr("My-consumption-01"), + // WorkloadProfileType: to.Ptr("Consumption"), + // }}, // ZoneRedundant: to.Ptr(true), // }, // }, @@ -120,9 +202,21 @@ func ExampleManagedEnvironmentsClient_NewListByResourceGroupPager() { // Tags: map[string]*string{ // }, // Properties: &armappcontainers.ManagedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name2.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name2.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, // DefaultDomain: to.Ptr("demo1.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("capp-svc-demo1-northcentralus"), // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), // StaticIP: to.Ptr("52.142.21.61"), + // VnetConfiguration: &armappcontainers.VnetConfiguration{ + // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + // }, // ZoneRedundant: to.Ptr(true), // }, // }}, @@ -130,7 +224,7 @@ func ExampleManagedEnvironmentsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironments_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json func ExampleManagedEnvironmentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -156,16 +250,177 @@ func ExampleManagedEnvironmentsClient_Get() { // Tags: map[string]*string{ // }, // Properties: &armappcontainers.ManagedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DaprConfiguration: &armappcontainers.DaprConfiguration{ + // Version: to.Ptr("1.9"), + // }, // DefaultDomain: to.Ptr("jlaw-demo1.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("capp-svc-jlaw-demo1-northcentralus"), + // KedaConfiguration: &armappcontainers.KedaConfiguration{ + // Version: to.Ptr("2.8.1"), + // }, // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), // StaticIP: to.Ptr("20.42.33.145"), + // VnetConfiguration: &armappcontainers.VnetConfiguration{ + // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + // }, + // WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + // { + // Name: to.Ptr("My-GP-01"), + // MaximumCount: to.Ptr[int32](12), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("GeneralPurpose"), + // }, + // { + // Name: to.Ptr("My-MO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("MemoryOptimized"), + // }, + // { + // Name: to.Ptr("My-CO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("ComputeOptimized"), + // }, + // { + // Name: to.Ptr("My-consumption-01"), + // WorkloadProfileType: to.Ptr("Consumption"), + // }}, + // ZoneRedundant: to.Ptr(true), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironmentWithCustomInfrastructureResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedEnvironmentsClient().BeginCreateOrUpdate(ctx, "examplerg", "testcontainerenv", armappcontainers.ManagedEnvironment{ + Location: to.Ptr("East US"), + Properties: &armappcontainers.ManagedEnvironmentProperties{ + AppLogsConfiguration: &armappcontainers.AppLogsConfiguration{ + LogAnalyticsConfiguration: &armappcontainers.LogAnalyticsConfiguration{ + CustomerID: to.Ptr("string"), + SharedKey: to.Ptr("string"), + }, + }, + CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + CertificatePassword: to.Ptr("1234"), + CertificateValue: []byte("Y2VydA=="), + DNSSuffix: to.Ptr("www.my-name.com"), + }, + DaprAIConnectionString: to.Ptr("InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/"), + InfrastructureResourceGroup: to.Ptr("myInfrastructureRgName"), + VnetConfiguration: &armappcontainers.VnetConfiguration{ + InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + }, + WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + { + Name: to.Ptr("My-GP-01"), + MaximumCount: to.Ptr[int32](12), + MinimumCount: to.Ptr[int32](3), + WorkloadProfileType: to.Ptr("GeneralPurpose"), + }, + { + Name: to.Ptr("My-MO-01"), + MaximumCount: to.Ptr[int32](6), + MinimumCount: to.Ptr[int32](3), + WorkloadProfileType: to.Ptr("MemoryOptimized"), + }, + { + Name: to.Ptr("My-CO-01"), + MaximumCount: to.Ptr[int32](6), + MinimumCount: to.Ptr[int32](3), + WorkloadProfileType: to.Ptr("ComputeOptimized"), + }, + { + Name: to.Ptr("My-consumption-01"), + WorkloadProfileType: to.Ptr("Consumption"), + }}, + ZoneRedundant: to.Ptr(true), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ManagedEnvironment = armappcontainers.ManagedEnvironment{ + // Name: to.Ptr("testcontainerenv"), + // Type: to.Ptr("Microsoft.App/managedEnvironments"), + // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.ManagedEnvironmentProperties{ + // AppLogsConfiguration: &armappcontainers.AppLogsConfiguration{ + // LogAnalyticsConfiguration: &armappcontainers.LogAnalyticsConfiguration{ + // CustomerID: to.Ptr("string"), + // }, + // }, + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("testcontainerenv.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("myInfrastructureRgName"), + // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("1.2.3.4"), + // VnetConfiguration: &armappcontainers.VnetConfiguration{ + // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + // }, + // WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + // { + // Name: to.Ptr("My-GP-01"), + // MaximumCount: to.Ptr[int32](12), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("GeneralPurpose"), + // }, + // { + // Name: to.Ptr("My-MO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("MemoryOptimized"), + // }, + // { + // Name: to.Ptr("My-CO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("ComputeOptimized"), + // }, + // { + // Name: to.Ptr("My-consumption-01"), + // WorkloadProfileType: to.Ptr("Consumption"), + // }}, // ZoneRedundant: to.Ptr(true), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironments_CreateOrUpdate.json -func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CreateOrUpdate.json +func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironments() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -184,8 +439,39 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate() { SharedKey: to.Ptr("string"), }, }, + CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + CertificatePassword: to.Ptr("1234"), + CertificateValue: []byte("Y2VydA=="), + DNSSuffix: to.Ptr("www.my-name.com"), + }, DaprAIConnectionString: to.Ptr("InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/"), - ZoneRedundant: to.Ptr(true), + VnetConfiguration: &armappcontainers.VnetConfiguration{ + InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + }, + WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + { + Name: to.Ptr("My-GP-01"), + MaximumCount: to.Ptr[int32](12), + MinimumCount: to.Ptr[int32](3), + WorkloadProfileType: to.Ptr("GeneralPurpose"), + }, + { + Name: to.Ptr("My-MO-01"), + MaximumCount: to.Ptr[int32](6), + MinimumCount: to.Ptr[int32](3), + WorkloadProfileType: to.Ptr("MemoryOptimized"), + }, + { + Name: to.Ptr("My-CO-01"), + MaximumCount: to.Ptr[int32](6), + MinimumCount: to.Ptr[int32](3), + WorkloadProfileType: to.Ptr("ComputeOptimized"), + }, + { + Name: to.Ptr("My-consumption-01"), + WorkloadProfileType: to.Ptr("Consumption"), + }}, + ZoneRedundant: to.Ptr(true), }, }, nil) if err != nil { @@ -209,15 +495,50 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate() { // CustomerID: to.Ptr("string"), // }, // }, + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, // DefaultDomain: to.Ptr("testcontainerenv.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("capp-svc-testcontainerenv-eastus"), // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), // StaticIP: to.Ptr("1.2.3.4"), + // VnetConfiguration: &armappcontainers.VnetConfiguration{ + // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + // }, + // WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + // { + // Name: to.Ptr("My-GP-01"), + // MaximumCount: to.Ptr[int32](12), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("GeneralPurpose"), + // }, + // { + // Name: to.Ptr("My-MO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("MemoryOptimized"), + // }, + // { + // Name: to.Ptr("My-CO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("ComputeOptimized"), + // }, + // { + // Name: to.Ptr("My-consumption-01"), + // WorkloadProfileType: to.Ptr("Consumption"), + // }}, // ZoneRedundant: to.Ptr(true), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironments_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Delete.json func ExampleManagedEnvironmentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -238,7 +559,7 @@ func ExampleManagedEnvironmentsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironments_Patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Patch.json func ExampleManagedEnvironmentsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -259,8 +580,135 @@ func ExampleManagedEnvironmentsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ManagedEnvironment = armappcontainers.ManagedEnvironment{ + // Name: to.Ptr("jlaw-demo1"), + // Type: to.Ptr("Microsoft.App/managedEnvironments"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/jlaw-demo1"), + // Location: to.Ptr("North Central US"), + // Tags: map[string]*string{ + // }, + // Properties: &armappcontainers.ManagedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DefaultDomain: to.Ptr("jlaw-demo1.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("capp-svc-jlaw-demo1-northcentralus"), + // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("20.42.33.145"), + // WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + // { + // Name: to.Ptr("My-GP-01"), + // MaximumCount: to.Ptr[int32](12), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("GeneralPurpose"), + // }, + // { + // Name: to.Ptr("My-MO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("MemoryOptimized"), + // }, + // { + // Name: to.Ptr("My-CO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("ComputeOptimized"), + // }, + // { + // Name: to.Ptr("My-consumption-01"), + // WorkloadProfileType: to.Ptr("Consumption"), + // }}, + // ZoneRedundant: to.Ptr(true), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_GetAuthToken.json +func ExampleManagedEnvironmentsClient_GetAuthToken() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedEnvironmentsClient().GetAuthToken(ctx, "rg", "testenv", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.EnvironmentAuthToken = armappcontainers.EnvironmentAuthToken{ + // Name: to.Ptr("testenv"), + // Type: to.Ptr("Microsoft.App/environments/accesstoken"), + // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/testenv"), + // Location: to.Ptr("East US"), + // Properties: &armappcontainers.EnvironmentAuthTokenProperties{ + // Expires: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-14T19:22:50.3080223Z"); return t}()), + // Token: to.Ptr("testToken"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json +func ExampleManagedEnvironmentsClient_NewListWorkloadProfileStatesPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedEnvironmentsClient().NewListWorkloadProfileStatesPager("examplerg", "jlaw-demo1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.WorkloadProfileStatesCollection = armappcontainers.WorkloadProfileStatesCollection{ + // Value: []*armappcontainers.WorkloadProfileStates{ + // { + // Name: to.Ptr("GP1"), + // Type: to.Ptr("/providers/Microsoft.App/workloadProfileStates"), + // ID: to.Ptr("/subscriptions/55f240e3-3d66-44f6-8358-4e4f3d7a2e51/providers/Microsoft.App/workloadProfileStates/GP1"), + // Properties: &armappcontainers.WorkloadProfileStatesProperties{ + // CurrentCount: to.Ptr[int32](3), + // MaximumCount: to.Ptr[int32](10), + // MinimumCount: to.Ptr[int32](3), + // }, + // }, + // { + // Name: to.Ptr("MO3"), + // Type: to.Ptr("/providers/Microsoft.App/workloadProfileStates"), + // ID: to.Ptr("/subscriptions/55f240e3-3d66-44f6-8358-4e4f3d7a2e51/providers/Microsoft.App/workloadProfileStates/MO3"), + // Properties: &armappcontainers.WorkloadProfileStatesProperties{ + // CurrentCount: to.Ptr[int32](0), + // MaximumCount: to.Ptr[int32](2), + // MinimumCount: to.Ptr[int32](0), + // }, + // }}, + // } + } } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go new file mode 100644 index 000000000000..9d02ed18d614 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedEnvironmentsDiagnosticsClient contains the methods for the ManagedEnvironmentsDiagnostics group. +// Don't use this type directly, use NewManagedEnvironmentsDiagnosticsClient() instead. +type ManagedEnvironmentsDiagnosticsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedEnvironmentsDiagnosticsClient creates a new instance of ManagedEnvironmentsDiagnosticsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedEnvironmentsDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentsDiagnosticsClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedEnvironmentsDiagnosticsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedEnvironmentsDiagnosticsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetRoot - Get the properties of a Managed Environment used to host container apps. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Environment. +// - options - ManagedEnvironmentsDiagnosticsClientGetRootOptions contains the optional parameters for the ManagedEnvironmentsDiagnosticsClient.GetRoot +// method. +func (client *ManagedEnvironmentsDiagnosticsClient) GetRoot(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsDiagnosticsClientGetRootOptions) (ManagedEnvironmentsDiagnosticsClientGetRootResponse, error) { + req, err := client.getRootCreateRequest(ctx, resourceGroupName, environmentName, options) + if err != nil { + return ManagedEnvironmentsDiagnosticsClientGetRootResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedEnvironmentsDiagnosticsClientGetRootResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedEnvironmentsDiagnosticsClientGetRootResponse{}, runtime.NewResponseError(resp) + } + return client.getRootHandleResponse(resp) +} + +// getRootCreateRequest creates the GetRoot request. +func (client *ManagedEnvironmentsDiagnosticsClient) getRootCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsDiagnosticsClientGetRootOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getRootHandleResponse handles the GetRoot response. +func (client *ManagedEnvironmentsDiagnosticsClient) getRootHandleResponse(resp *http.Response) (ManagedEnvironmentsDiagnosticsClientGetRootResponse, error) { + result := ManagedEnvironmentsDiagnosticsClientGetRootResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedEnvironment); err != nil { + return ManagedEnvironmentsDiagnosticsClientGetRootResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go new file mode 100644 index 000000000000..a4a4f4e6c264 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go @@ -0,0 +1,93 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json +func ExampleManagedEnvironmentsDiagnosticsClient_GetRoot() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedEnvironmentsDiagnosticsClient().GetRoot(ctx, "examplerg", "jlaw-demo1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ManagedEnvironment = armappcontainers.ManagedEnvironment{ + // Name: to.Ptr("jlaw-demo1"), + // Type: to.Ptr("Microsoft.App/managedEnvironments"), + // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/jlaw-demo1"), + // Location: to.Ptr("North Central US"), + // Tags: map[string]*string{ + // }, + // Properties: &armappcontainers.ManagedEnvironmentProperties{ + // CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ + // CustomDomainVerificationID: to.Ptr("custom domain verification id"), + // DNSSuffix: to.Ptr("www.my-name.com"), + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00Z"); return t}()), + // SubjectName: to.Ptr("CN=www.my-name.com"), + // Thumbprint: to.Ptr("CERTIFICATE_THUMBPRINT"), + // }, + // DaprConfiguration: &armappcontainers.DaprConfiguration{ + // Version: to.Ptr("1.9"), + // }, + // DefaultDomain: to.Ptr("jlaw-demo1.k4apps.io"), + // EventStreamEndpoint: to.Ptr("testEndpoint"), + // InfrastructureResourceGroup: to.Ptr("capp-svc-jlaw-demo1-northcentralus"), + // KedaConfiguration: &armappcontainers.KedaConfiguration{ + // Version: to.Ptr("2.8.1"), + // }, + // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), + // StaticIP: to.Ptr("20.42.33.145"), + // VnetConfiguration: &armappcontainers.VnetConfiguration{ + // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), + // }, + // WorkloadProfiles: []*armappcontainers.WorkloadProfile{ + // { + // Name: to.Ptr("My-GP-01"), + // MaximumCount: to.Ptr[int32](12), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("GeneralPurpose"), + // }, + // { + // Name: to.Ptr("My-MO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("MemoryOptimized"), + // }, + // { + // Name: to.Ptr("My-CO-01"), + // MaximumCount: to.Ptr[int32](6), + // MinimumCount: to.Ptr[int32](3), + // WorkloadProfileType: to.Ptr("ComputeOptimized"), + // }, + // { + // Name: to.Ptr("My-consumption-01"), + // WorkloadProfileType: to.Ptr("Consumption"), + // }}, + // ZoneRedundant: to.Ptr(true), + // }, + // } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go index f9dd62f20dd5..1a376c3d1014 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go @@ -47,7 +47,7 @@ func NewManagedEnvironmentsStoragesClient(subscriptionID string, credential azco // CreateOrUpdate - Create or update storage for a managedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -93,7 +93,7 @@ func (client *ManagedEnvironmentsStoragesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, storageEnvelope) @@ -111,7 +111,7 @@ func (client *ManagedEnvironmentsStoragesClient) createOrUpdateHandleResponse(re // Delete - Delete storage for a managedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -156,7 +156,7 @@ func (client *ManagedEnvironmentsStoragesClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -165,7 +165,7 @@ func (client *ManagedEnvironmentsStoragesClient) deleteCreateRequest(ctx context // Get - Get storage for a managedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -210,7 +210,7 @@ func (client *ManagedEnvironmentsStoragesClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +228,7 @@ func (client *ManagedEnvironmentsStoragesClient) getHandleResponse(resp *http.Re // List - Get all storages for a managedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - options - ManagedEnvironmentsStoragesClientListOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.List @@ -268,7 +268,7 @@ func (client *ManagedEnvironmentsStoragesClient) listCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client_example_test.go index 0aa922970acc..9cec79f3159b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironmentsStorages_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_List.json func ExampleManagedEnvironmentsStoragesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -53,7 +53,7 @@ func ExampleManagedEnvironmentsStoragesClient_List() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironmentsStorages_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Get.json func ExampleManagedEnvironmentsStoragesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,7 +85,7 @@ func ExampleManagedEnvironmentsStoragesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json func ExampleManagedEnvironmentsStoragesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -126,7 +126,7 @@ func ExampleManagedEnvironmentsStoragesClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ManagedEnvironmentsStorages_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Delete.json func ExampleManagedEnvironmentsStoragesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/models.go b/sdk/resourcemanager/appcontainers/armappcontainers/models.go index 6bfd7cb5dcc7..bf84ff3ea91f 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/models.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/models.go @@ -14,151 +14,205 @@ import "time" // AllowedAudiencesValidation - The configuration settings of the Allowed Audiences validation flow. type AllowedAudiencesValidation struct { // The configuration settings of the allowed list of audiences from which to validate the JWT token. - AllowedAudiences []*string `json:"allowedAudiences,omitempty"` + AllowedAudiences []*string } // AllowedPrincipals - The configuration settings of the Azure Active Directory allowed principals. type AllowedPrincipals struct { // The list of the allowed groups. - Groups []*string `json:"groups,omitempty"` + Groups []*string // The list of the allowed identities. - Identities []*string `json:"identities,omitempty"` + Identities []*string } // AppLogsConfiguration - Configuration of application logs type AppLogsConfiguration struct { // Logs destination - Destination *string `json:"destination,omitempty"` + Destination *string // Log Analytics configuration - LogAnalyticsConfiguration *LogAnalyticsConfiguration `json:"logAnalyticsConfiguration,omitempty"` + LogAnalyticsConfiguration *LogAnalyticsConfiguration } // AppRegistration - The configuration settings of the app registration for providers that have app ids and app secrets type AppRegistration struct { // The App ID of the app used for login. - AppID *string `json:"appId,omitempty"` + AppID *string // The app setting name that contains the app secret. - AppSecretSettingName *string `json:"appSecretSettingName,omitempty"` + AppSecretSettingName *string } // Apple - The configuration settings of the Apple provider. type Apple struct { // false if the Apple provider should not be enabled despite the set registration; otherwise, true. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // The configuration settings of the login flow. - Login *LoginScopes `json:"login,omitempty"` + Login *LoginScopes // The configuration settings of the Apple registration. - Registration *AppleRegistration `json:"registration,omitempty"` + Registration *AppleRegistration } // 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"` + ClientID *string // The app setting name that contains the client secret. - ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` + ClientSecretSettingName *string } // AuthConfig - Configuration settings for the Azure ContainerApp Service Authentication / Authorization feature. type AuthConfig struct { // AuthConfig resource specific properties - Properties *AuthConfigProperties `json:"properties,omitempty"` + Properties *AuthConfigProperties // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // AuthConfigCollection - AuthConfig collection ARM resource. type AuthConfigCollection struct { // REQUIRED; Collection of resources. - Value []*AuthConfig `json:"value,omitempty"` + Value []*AuthConfig // READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // AuthConfigProperties - AuthConfig resource specific properties type AuthConfigProperties struct { // The configuration settings that determines the validation flow of users using Service Authentication/Authorization. - GlobalValidation *GlobalValidation `json:"globalValidation,omitempty"` + GlobalValidation *GlobalValidation // The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp // Service Authentication/Authorization. - HTTPSettings *HTTPSettings `json:"httpSettings,omitempty"` + HTTPSettings *HTTPSettings // The configuration settings of each of the identity providers used to configure ContainerApp Service Authentication/Authorization. - IdentityProviders *IdentityProviders `json:"identityProviders,omitempty"` + IdentityProviders *IdentityProviders // The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. - Login *Login `json:"login,omitempty"` + Login *Login // The configuration settings of the platform of ContainerApp Service Authentication/Authorization. - Platform *AuthPlatform `json:"platform,omitempty"` + Platform *AuthPlatform } // AuthPlatform - The configuration settings of the platform of ContainerApp Service Authentication/Authorization. type AuthPlatform struct { // true if the Authentication / Authorization feature is enabled for the current app; otherwise, false. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // The RuntimeVersion of the Authentication / Authorization feature in use for the current app. The setting in this value // can control the behavior of certain features in the Authentication / // Authorization module. - RuntimeVersion *string `json:"runtimeVersion,omitempty"` + RuntimeVersion *string } // 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"` + NextLink *string // Collection of available operation details - Value []*OperationDetail `json:"value,omitempty"` + Value []*OperationDetail +} + +// AvailableWorkloadProfile - A workload profile with specific hardware configure to run container apps. +type AvailableWorkloadProfile struct { + // Region of the workload profile. + Location *string + + // Revision resource specific properties + Properties *AvailableWorkloadProfileProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AvailableWorkloadProfileProperties - Revision resource specific properties +type AvailableWorkloadProfileProperties struct { + // indicates whether the profile is default for the location. + Applicability *Applicability + + // Used to categorize workload profiles. + Category *string + + // Number of cores in CPU. + Cores *int32 + + // The everyday name of the workload profile. + DisplayName *string + + // Memory in GiB. + MemoryGiB *int32 +} + +// AvailableWorkloadProfilesClientGetOptions contains the optional parameters for the AvailableWorkloadProfilesClient.NewGetPager +// method. +type AvailableWorkloadProfilesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AvailableWorkloadProfilesCollection - Collection of available workload profiles in the location. +type AvailableWorkloadProfilesCollection struct { + // REQUIRED; Collection of workload profiles. + Value []*AvailableWorkloadProfile + + // READ-ONLY; Link to next page of resources. + NextLink *string } // AzureActiveDirectory - The configuration settings of the Azure Active directory provider. type AzureActiveDirectory struct { // false if the Azure Active Directory provider should not be enabled despite the set registration; otherwise, true. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Gets a value indicating whether the Azure AD configuration was auto-provisioned using 1st party tooling. This is an internal // flag primarily intended to support the Azure Management Portal. Users // should not read or write to this property. - IsAutoProvisioned *bool `json:"isAutoProvisioned,omitempty"` + IsAutoProvisioned *bool // The configuration settings of the Azure Active Directory login flow. - Login *AzureActiveDirectoryLogin `json:"login,omitempty"` + Login *AzureActiveDirectoryLogin // The configuration settings of the Azure Active Directory app registration. - Registration *AzureActiveDirectoryRegistration `json:"registration,omitempty"` + Registration *AzureActiveDirectoryRegistration // The configuration settings of the Azure Active Directory token validation flow. - Validation *AzureActiveDirectoryValidation `json:"validation,omitempty"` + Validation *AzureActiveDirectoryValidation } // AzureActiveDirectoryLogin - The configuration settings of the Azure Active Directory login flow. type AzureActiveDirectoryLogin struct { // true if the www-authenticate provider should be omitted from the request; otherwise, false. - DisableWWWAuthenticate *bool `json:"disableWWWAuthenticate,omitempty"` + DisableWWWAuthenticate *bool // 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"` + LoginParameters []*string } // AzureActiveDirectoryRegistration - The configuration settings of the Azure Active Directory app registration. @@ -166,160 +220,231 @@ 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"` + ClientID *string // 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"` + ClientSecretCertificateIssuer *string // 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"` + ClientSecretCertificateSubjectAlternativeName *string // 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"` + ClientSecretCertificateThumbprint *string // The app setting name that contains the client secret of the relying party application. - ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` + ClientSecretSettingName *string // 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"` + OpenIDIssuer *string } // 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"` + AllowedAudiences []*string // The configuration settings of the default authorization policy. - DefaultAuthorizationPolicy *DefaultAuthorizationPolicy `json:"defaultAuthorizationPolicy,omitempty"` + DefaultAuthorizationPolicy *DefaultAuthorizationPolicy // The configuration settings of the checks that should be made while validating the JWT Claims. - JwtClaimChecks *JwtClaimChecks `json:"jwtClaimChecks,omitempty"` + JwtClaimChecks *JwtClaimChecks } // AzureCredentials - Container App credentials. type AzureCredentials struct { // Client Id. - ClientID *string `json:"clientId,omitempty"` + ClientID *string // Client Secret. - ClientSecret *string `json:"clientSecret,omitempty"` + ClientSecret *string // Subscription Id. - SubscriptionID *string `json:"subscriptionId,omitempty"` + SubscriptionID *string // Tenant Id. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } // AzureFileProperties - Azure File Properties. type AzureFileProperties struct { // Access mode for storage - AccessMode *AccessMode `json:"accessMode,omitempty"` + AccessMode *AccessMode // Storage account key for azure file. - AccountKey *string `json:"accountKey,omitempty"` + AccountKey *string // Storage account name for azure file. - AccountName *string `json:"accountName,omitempty"` + AccountName *string // Azure file share name. - ShareName *string `json:"shareName,omitempty"` + ShareName *string } // AzureStaticWebApps - The configuration settings of the Azure Static Web Apps provider. type AzureStaticWebApps struct { // false if the Azure Static Web Apps provider should not be enabled despite the set registration; otherwise, true. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // The configuration settings of the Azure Static Web Apps registration. - Registration *AzureStaticWebAppsRegistration `json:"registration,omitempty"` + Registration *AzureStaticWebAppsRegistration } // AzureStaticWebAppsRegistration - The configuration settings of the registration for the Azure Static Web Apps provider type AzureStaticWebAppsRegistration struct { // The Client ID of the app used for login. - ClientID *string `json:"clientId,omitempty"` + ClientID *string +} + +// BaseContainer - Container App base container definition. +type BaseContainer struct { + // Container start command arguments. + Args []*string + + // Container start command. + Command []*string + + // Container environment variables. + Env []*EnvironmentVar + + // Container image tag. + Image *string + + // Custom container name. + Name *string + + // Container resource requirements. + Resources *ContainerResources + + // Container volume mounts. + VolumeMounts []*VolumeMount +} + +// BillingMeter - Billing meter. +type BillingMeter struct { + // Region for the billing meter. + Location *string + + // Revision resource specific properties + Properties *BillingMeterProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BillingMeterCollection - Collection of billing meters. +type BillingMeterCollection struct { + // REQUIRED; Collection of billing meters. + Value []*BillingMeter +} + +// BillingMeterProperties - Revision resource specific properties +type BillingMeterProperties struct { + // Used to categorize billing meters. + Category *string + + // The everyday name of the billing meter. + DisplayName *string + + // Billing meter type. + MeterType *string +} + +// BillingMetersClientGetOptions contains the optional parameters for the BillingMetersClient.Get method. +type BillingMetersClientGetOptions struct { + // placeholder for future optional parameters } // 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"` + Location *string // Certificate resource specific properties - Properties *CertificateProperties `json:"properties,omitempty"` + Properties *CertificateProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // CertificateCollection - Collection of Certificates. type CertificateCollection struct { // REQUIRED; Collection of resources. - Value []*Certificate `json:"value,omitempty"` + Value []*Certificate // READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // 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"` + Tags map[string]*string } // CertificateProperties - Certificate resource specific properties type CertificateProperties struct { // Certificate password. - Password *string `json:"password,omitempty"` + Password *string // PFX or PEM blob - Value []byte `json:"value,omitempty"` + Value []byte // READ-ONLY; Certificate expiration date. - ExpirationDate *time.Time `json:"expirationDate,omitempty" azure:"ro"` + ExpirationDate *time.Time // READ-ONLY; Certificate issue Date. - IssueDate *time.Time `json:"issueDate,omitempty" azure:"ro"` + IssueDate *time.Time // READ-ONLY; Certificate issuer. - Issuer *string `json:"issuer,omitempty" azure:"ro"` + Issuer *string // READ-ONLY; Provisioning state of the certificate. - ProvisioningState *CertificateProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *CertificateProvisioningState // READ-ONLY; Public key hash. - PublicKeyHash *string `json:"publicKeyHash,omitempty" azure:"ro"` + PublicKeyHash *string + + // READ-ONLY; Subject alternative names the certificate applies to. + SubjectAlternativeNames []*string // READ-ONLY; Subject name of the certificate. - SubjectName *string `json:"subjectName,omitempty" azure:"ro"` + SubjectName *string // READ-ONLY; Certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` + Thumbprint *string // READ-ONLY; Is the certificate valid?. - Valid *bool `json:"valid,omitempty" azure:"ro"` + Valid *bool } // CertificatesClientCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.CreateOrUpdate method. @@ -351,31 +476,31 @@ type CertificatesClientUpdateOptions struct { // CheckNameAvailabilityRequest - The check availability request body. type CheckNameAvailabilityRequest struct { // The name of the resource for which availability needs to be checked. - Name *string `json:"name,omitempty"` + Name *string // The resource type. - Type *string `json:"type,omitempty"` + Type *string } // CheckNameAvailabilityResponse - The check availability result. type CheckNameAvailabilityResponse struct { // Detailed reason why the given name is available. - Message *string `json:"message,omitempty"` + Message *string // Indicates if the resource name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` + NameAvailable *bool // The reason why the given name is not available. - Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` + Reason *CheckNameAvailabilityReason } // 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"` + ClientID *string // The app setting name that contains the client secret. - ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` + ClientSecretSettingName *string } // Configuration - Non versioned Container App configuration properties that define the mutable settings of a Container app @@ -383,83 +508,350 @@ type Configuration struct { // ActiveRevisionsMode controls how active revisions are handled for the Container app:Multiple: multiple revisions can be // active.Single: Only one revision can be active at a time. Revision weights can // not be used in this mode. If no value if provided, this is the default. - ActiveRevisionsMode *ActiveRevisionsMode `json:"activeRevisionsMode,omitempty"` + ActiveRevisionsMode *ActiveRevisionsMode // Dapr configuration for the Container App. - Dapr *Dapr `json:"dapr,omitempty"` + Dapr *Dapr // Ingress configurations. - Ingress *Ingress `json:"ingress,omitempty"` + Ingress *Ingress + + // Optional. Max inactive revisions a Container App can have. + MaxInactiveRevisions *int32 // Collection of private container registry credentials for containers used by the Container app - Registries []*RegistryCredentials `json:"registries,omitempty"` + Registries []*RegistryCredentials // Collection of secrets used by a Container app - Secrets []*Secret `json:"secrets,omitempty"` + Secrets []*Secret +} + +// ConnectedEnvironment - An environment for Kubernetes cluster specialized for web workloads by Azure App Service +type ConnectedEnvironment struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The complex type of the extended location. + ExtendedLocation *ExtendedLocation + + // ConnectedEnvironment resource specific properties + Properties *ConnectedEnvironmentProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ConnectedEnvironmentCollection - Collection of connectedEnvironments +type ConnectedEnvironmentCollection struct { + // Collection of resources. + Value []*ConnectedEnvironment + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// ConnectedEnvironmentProperties - ConnectedEnvironment resource specific properties +type ConnectedEnvironmentProperties struct { + // Custom domain configuration for the environment + CustomDomainConfiguration *CustomDomainConfiguration + + // Application Insights connection string used by Dapr to export Service to Service communication telemetry + DaprAIConnectionString *string + + // Static IP of the connectedEnvironment + StaticIP *string + + // READ-ONLY; Default Domain Name for the cluster + DefaultDomain *string + + // READ-ONLY; Any errors that occurred during deployment or deployment validation + DeploymentErrors *string + + // READ-ONLY; Provisioning state of the Kubernetes Environment. + ProvisioningState *ConnectedEnvironmentProvisioningState +} + +// ConnectedEnvironmentStorage - Storage resource for connectedEnvironment. +type ConnectedEnvironmentStorage struct { + // Storage properties + Properties *ConnectedEnvironmentStorageProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ConnectedEnvironmentStorageProperties - Storage properties +type ConnectedEnvironmentStorageProperties struct { + // Azure file properties + AzureFile *AzureFileProperties +} + +// ConnectedEnvironmentStoragesCollection - Collection of Storage for Environments +type ConnectedEnvironmentStoragesCollection struct { + // REQUIRED; Collection of storage resources. + Value []*ConnectedEnvironmentStorage +} + +// ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.CreateOrUpdate +// method. +type ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions struct { + // Certificate to be created or updated + CertificateEnvelope *Certificate +} + +// ConnectedEnvironmentsCertificatesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Delete +// method. +type ConnectedEnvironmentsCertificatesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsCertificatesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Get +// method. +type ConnectedEnvironmentsCertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsCertificatesClientListOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.NewListPager +// method. +type ConnectedEnvironmentsCertificatesClientListOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsCertificatesClientUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Update +// method. +type ConnectedEnvironmentsCertificatesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsClient.BeginCreateOrUpdate +// method. +type ConnectedEnvironmentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectedEnvironmentsClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsClient.BeginDelete +// method. +type ConnectedEnvironmentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectedEnvironmentsClientCheckNameAvailabilityOptions contains the optional parameters for the ConnectedEnvironmentsClient.CheckNameAvailability +// method. +type ConnectedEnvironmentsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsClient.Get method. +type ConnectedEnvironmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ConnectedEnvironmentsClient.NewListByResourceGroupPager +// method. +type ConnectedEnvironmentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ConnectedEnvironmentsClient.NewListBySubscriptionPager +// method. +type ConnectedEnvironmentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsClientUpdateOptions contains the optional parameters for the ConnectedEnvironmentsClient.Update method. +type ConnectedEnvironmentsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate +// method. +type ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Delete +// method. +type ConnectedEnvironmentsDaprComponentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Get +// method. +type ConnectedEnvironmentsDaprComponentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientListOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.NewListPager +// method. +type ConnectedEnvironmentsDaprComponentsClientListOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsDaprComponentsClientListSecretsOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.ListSecrets +// method. +type ConnectedEnvironmentsDaprComponentsClientListSecretsOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.CreateOrUpdate +// method. +type ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsStoragesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Delete +// method. +type ConnectedEnvironmentsStoragesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsStoragesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Get +// method. +type ConnectedEnvironmentsStoragesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectedEnvironmentsStoragesClientListOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.List +// method. +type ConnectedEnvironmentsStoragesClientListOptions struct { + // placeholder for future optional parameters } -// Container App container definition. +// Container App container definition type Container struct { // Container start command arguments. - Args []*string `json:"args,omitempty"` + Args []*string // Container start command. - Command []*string `json:"command,omitempty"` + Command []*string // Container environment variables. - Env []*EnvironmentVar `json:"env,omitempty"` + Env []*EnvironmentVar // Container image tag. - Image *string `json:"image,omitempty"` + Image *string // Custom container name. - Name *string `json:"name,omitempty"` + Name *string // List of probes for the container. - Probes []*ContainerAppProbe `json:"probes,omitempty"` + Probes []*ContainerAppProbe // Container resource requirements. - Resources *ContainerResources `json:"resources,omitempty"` + Resources *ContainerResources // Container volume mounts. - VolumeMounts []*VolumeMount `json:"volumeMounts,omitempty"` + VolumeMounts []*VolumeMount } // ContainerApp - Container App. type ContainerApp struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string + + // The complex type of the extended location. + ExtendedLocation *ExtendedLocation // 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"` + Identity *ManagedServiceIdentity + + // The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another + // Azure resource. If this is present, complete mode deployment will not + // delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string // ContainerApp resource specific properties - Properties *ContainerAppProperties `json:"properties,omitempty"` + Properties *ContainerAppProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ContainerAppAuthToken - Container App Auth Token. +type ContainerAppAuthToken struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Container App auth token resource specific properties + Properties *ContainerAppAuthTokenProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string +} + +// ContainerAppAuthTokenProperties - Container App auth token resource specific properties +type ContainerAppAuthTokenProperties struct { + // READ-ONLY; Token expiration date. + Expires *time.Time + + // READ-ONLY; Auth token value. + Token *string } // ContainerAppCollection - Container App collection ARM resource. type ContainerAppCollection struct { // REQUIRED; Collection of resources. - Value []*ContainerApp `json:"value,omitempty"` + Value []*ContainerApp + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// ContainerAppJobExecutions - Container App executions collection ARM resource. +type ContainerAppJobExecutions struct { + // REQUIRED; Collection of resources. + Value []*JobExecution // READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // ContainerAppProbe - Probe describes a health check to be performed against a container to determine whether it is alive @@ -467,24 +859,24 @@ type ContainerAppCollection struct { 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"` + FailureThreshold *int32 // HTTPGet specifies the http request to perform. - HTTPGet *ContainerAppProbeHTTPGet `json:"httpGet,omitempty"` + HTTPGet *ContainerAppProbeHTTPGet // 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"` + InitialDelaySeconds *int32 // 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"` + PeriodSeconds *int32 // 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"` + SuccessThreshold *int32 // TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. - TCPSocket *ContainerAppProbeTCPSocket `json:"tcpSocket,omitempty"` + TCPSocket *ContainerAppProbeTCPSocket // 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 @@ -494,87 +886,105 @@ type ContainerAppProbe struct { // 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"` + TerminationGracePeriodSeconds *int64 // 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"` + TimeoutSeconds *int32 // The type of probe. - Type *Type `json:"type,omitempty"` + Type *Type } // 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"` + Port *int32 // Custom headers to set in the request. HTTP allows repeated headers. - HTTPHeaders []*ContainerAppProbeHTTPGetHTTPHeadersItem `json:"httpHeaders,omitempty"` + HTTPHeaders []*ContainerAppProbeHTTPGetHTTPHeadersItem // Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead. - Host *string `json:"host,omitempty"` + Host *string // Path to access on the HTTP server. - Path *string `json:"path,omitempty"` + Path *string // Scheme to use for connecting to the host. Defaults to HTTP. - Scheme *Scheme `json:"scheme,omitempty"` + Scheme *Scheme } // 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"` + Name *string // REQUIRED; The header field value - Value *string `json:"value,omitempty"` + Value *string } // 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"` + Port *int32 // Optional: Host name to connect to, defaults to the pod IP. - Host *string `json:"host,omitempty"` + Host *string } // ContainerAppProperties - ContainerApp resource specific properties type ContainerAppProperties struct { // Non versioned Container App configuration properties. - Configuration *Configuration `json:"configuration,omitempty"` + Configuration *Configuration + + // Resource ID of environment. + EnvironmentID *string - // Resource ID of the Container App's environment. - ManagedEnvironmentID *string `json:"managedEnvironmentId,omitempty"` + // Deprecated. Resource ID of the Container App's environment. + ManagedEnvironmentID *string // Container App versioned application definition. - Template *Template `json:"template,omitempty"` + Template *Template + + // Workload profile name to pin for container app execution. + WorkloadProfileName *string // READ-ONLY; Id used to verify domain name ownership - CustomDomainVerificationID *string `json:"customDomainVerificationId,omitempty" azure:"ro"` + CustomDomainVerificationID *string + + // READ-ONLY; The endpoint of the eventstream of the container app. + EventStreamEndpoint *string + + // READ-ONLY; Name of the latest ready revision of the Container App. + LatestReadyRevisionName *string // READ-ONLY; Fully Qualified Domain Name of the latest revision of the Container App. - LatestRevisionFqdn *string `json:"latestRevisionFqdn,omitempty" azure:"ro"` + LatestRevisionFqdn *string // READ-ONLY; Name of the latest revision of the Container App. - LatestRevisionName *string `json:"latestRevisionName,omitempty" azure:"ro"` + LatestRevisionName *string // READ-ONLY; Outbound IP Addresses for container app. - OutboundIPAddresses []*string `json:"outboundIPAddresses,omitempty" azure:"ro"` + OutboundIPAddresses []*string // READ-ONLY; Provisioning state of the Container App. - ProvisioningState *ContainerAppProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *ContainerAppProvisioningState } // ContainerAppSecret - Container App Secret. type ContainerAppSecret struct { + // READ-ONLY; Resource ID of a managed identity to authenticate with Azure Key Vault, or System to use a system-assigned identity. + Identity *string + + // READ-ONLY; Azure Key Vault URL pointing to the secret referenced by the container app. + KeyVaultURL *string + // READ-ONLY; Secret Name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Secret Value. - Value *string `json:"value,omitempty" azure:"ro"` + Value *string } // ContainerAppsAuthConfigsClientCreateOrUpdateOptions contains the optional parameters for the ContainerAppsAuthConfigsClient.CreateOrUpdate @@ -619,6 +1029,11 @@ type ContainerAppsClientBeginUpdateOptions struct { ResumeToken string } +// ContainerAppsClientGetAuthTokenOptions contains the optional parameters for the ContainerAppsClient.GetAuthToken method. +type ContainerAppsClientGetAuthTokenOptions struct { + // placeholder for future optional parameters +} + // ContainerAppsClientGetOptions contains the optional parameters for the ContainerAppsClient.Get method. type ContainerAppsClientGetOptions struct { // placeholder for future optional parameters @@ -648,6 +1063,37 @@ type ContainerAppsClientListSecretsOptions struct { // placeholder for future optional parameters } +// ContainerAppsDiagnosticsClientGetDetectorOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetDetector +// method. +type ContainerAppsDiagnosticsClientGetDetectorOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientGetRevisionOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetRevision +// method. +type ContainerAppsDiagnosticsClientGetRevisionOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientGetRootOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.GetRoot +// method. +type ContainerAppsDiagnosticsClientGetRootOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientListDetectorsOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.NewListDetectorsPager +// method. +type ContainerAppsDiagnosticsClientListDetectorsOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsDiagnosticsClientListRevisionsOptions contains the optional parameters for the ContainerAppsDiagnosticsClient.NewListRevisionsPager +// method. +type ContainerAppsDiagnosticsClientListRevisionsOptions struct { + // The filter to apply on the operation. + Filter *string +} + // ContainerAppsRevisionReplicasClientGetReplicaOptions contains the optional parameters for the ContainerAppsRevisionReplicasClient.GetReplica // method. type ContainerAppsRevisionReplicasClientGetReplicaOptions struct { @@ -720,169 +1166,242 @@ type ContainerAppsSourceControlsClientListByContainerAppOptions struct { // ContainerResources - Container App container resource requirements. type ContainerResources struct { // Required CPU in cores, e.g. 0.5 - CPU *float64 `json:"cpu,omitempty"` + CPU *float64 // Required memory, e.g. "250Mb" - Memory *string `json:"memory,omitempty"` + Memory *string // READ-ONLY; Ephemeral Storage, e.g. "1Gi" - EphemeralStorage *string `json:"ephemeralStorage,omitempty" azure:"ro"` + EphemeralStorage *string } // CookieExpiration - The configuration settings of the session cookie's expiration. type CookieExpiration struct { // The convention used when determining the session cookie's expiration. - Convention *CookieExpirationConvention `json:"convention,omitempty"` + Convention *CookieExpirationConvention // The time after the request is made when the session cookie should expire. - TimeToExpiration *string `json:"timeToExpiration,omitempty"` + TimeToExpiration *string } -// CustomDomain - Custom Domain of a Container App -type CustomDomain struct { - // REQUIRED; Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. - CertificateID *string `json:"certificateId,omitempty"` +// CorsPolicy - Cross-Origin-Resource-Sharing policy +type CorsPolicy struct { + // REQUIRED; Specifies the content for the access-control-allow-origins header + AllowedOrigins []*string - // REQUIRED; Hostname. - Name *string `json:"name,omitempty"` + // Specifies whether the resource allows credentials + AllowCredentials *bool - // Custom Domain binding type. - BindingType *BindingType `json:"bindingType,omitempty"` -} + // Specifies the content for the access-control-allow-headers header + AllowedHeaders []*string -// CustomHostnameAnalysisResult - Custom domain analysis. -type CustomHostnameAnalysisResult struct { - // CustomHostnameAnalysisResult resource specific properties - Properties *CustomHostnameAnalysisResultProperties `json:"properties,omitempty"` + // Specifies the content for the access-control-allow-methods header + AllowedMethods []*string - // 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"` + // Specifies the content for the access-control-expose-headers header + ExposeHeaders []*string - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + // Specifies the content for the access-control-max-age header + MaxAge *int32 +} - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +// CustomDomain - Custom Domain of a Container App +type CustomDomain struct { + // REQUIRED; Hostname. + Name *string - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + // Custom Domain binding type. + BindingType *BindingType + + // Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. + CertificateID *string } -// CustomHostnameAnalysisResultProperties - CustomHostnameAnalysisResult resource specific properties -type CustomHostnameAnalysisResultProperties struct { +// CustomDomainConfiguration - Configuration properties for apps environment custom domain +type CustomDomainConfiguration struct { + // Certificate password + CertificatePassword *string + + // PFX or PEM blob + CertificateValue []byte + + // Dns suffix for the environment domain + DNSSuffix *string + + // READ-ONLY; Id used to verify domain name ownership + CustomDomainVerificationID *string + + // READ-ONLY; Certificate expiration date. + ExpirationDate *time.Time + + // READ-ONLY; Subject name of the certificate. + SubjectName *string + + // READ-ONLY; Certificate thumbprint. + Thumbprint *string +} + +// CustomHostnameAnalysisResult - Custom domain analysis. +type CustomHostnameAnalysisResult struct { // A records visible for this hostname. - ARecords []*string `json:"aRecords,omitempty"` + ARecords []*string // Alternate CName records visible for this hostname. - AlternateCNameRecords []*string `json:"alternateCNameRecords,omitempty"` + AlternateCNameRecords []*string // Alternate TXT records visible for this hostname. - AlternateTxtRecords []*string `json:"alternateTxtRecords,omitempty"` + AlternateTxtRecords []*string // CName records visible for this hostname. - CNameRecords []*string `json:"cNameRecords,omitempty"` + CNameRecords []*string // TXT records visible for this hostname. - TxtRecords []*string `json:"txtRecords,omitempty"` + TxtRecords []*string + + // READ-ONLY; true if there is a conflict on the Container App's managed environment level custom domain; otherwise, false. + ConflictWithEnvironmentCustomDomain *bool // 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"` + ConflictingContainerAppResourceID *string // READ-ONLY; Raw failure information if DNS verification fails. - CustomDomainVerificationFailureInfo *DefaultErrorResponse `json:"customDomainVerificationFailureInfo,omitempty" azure:"ro"` + CustomDomainVerificationFailureInfo *CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo // READ-ONLY; DNS verification test result. - CustomDomainVerificationTest *DNSVerificationTestResult `json:"customDomainVerificationTest,omitempty" azure:"ro"` + CustomDomainVerificationTest *DNSVerificationTestResult // READ-ONLY; true if there is a conflict on the Container App's managed environment; otherwise, false. - HasConflictOnManagedEnvironment *bool `json:"hasConflictOnManagedEnvironment,omitempty" azure:"ro"` + HasConflictOnManagedEnvironment *bool // READ-ONLY; Host name that was analyzed - HostName *string `json:"hostName,omitempty" azure:"ro"` + HostName *string // READ-ONLY; true if hostname is already verified; otherwise, false. - IsHostnameAlreadyVerified *bool `json:"isHostnameAlreadyVerified,omitempty" azure:"ro"` + IsHostnameAlreadyVerified *bool +} + +// CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo - Raw failure information if DNS verification fails. +type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo struct { + // Details or the error + Details []*CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem + + // READ-ONLY; Standardized string to programmatically identify the error. + Code *string + + // READ-ONLY; Detailed error description and debugging information. + Message *string + + // READ-ONLY; Detailed error description and debugging information. + Target *string +} + +// CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem - Detailed errors. +type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem struct { + // READ-ONLY; Standardized string to programmatically identify the error. + Code *string + + // READ-ONLY; Detailed error description and debugging information. + Message *string + + // READ-ONLY; Detailed error description and debugging information. + Target *string } // CustomOpenIDConnectProvider - The configuration settings of the custom Open ID Connect provider. type CustomOpenIDConnectProvider struct { // false if the custom Open ID provider provider should not be enabled; otherwise, true. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // The configuration settings of the login flow of the custom Open ID Connect provider. - Login *OpenIDConnectLogin `json:"login,omitempty"` + Login *OpenIDConnectLogin // The configuration settings of the app registration for the custom Open ID Connect provider. - Registration *OpenIDConnectRegistration `json:"registration,omitempty"` + Registration *OpenIDConnectRegistration } // CustomScaleRule - Container App container Custom scaling rule. type CustomScaleRule struct { // Authentication secrets for the custom scale rule. - Auth []*ScaleRuleAuth `json:"auth,omitempty"` + Auth []*ScaleRuleAuth // Metadata properties to describe custom scale rule. - Metadata map[string]*string `json:"metadata,omitempty"` + Metadata map[string]*string // Type of the custom scale rule eg: azure-servicebus, redis etc. - Type *string `json:"type,omitempty"` + Type *string } // Dapr - Container App Dapr configuration. type Dapr struct { // Dapr application identifier - AppID *string `json:"appId,omitempty"` + AppID *string // Tells Dapr which port your application is listening on - AppPort *int32 `json:"appPort,omitempty"` + AppPort *int32 // Tells Dapr which protocol your application is using. Valid options are http and grpc. Default is http - AppProtocol *AppProtocol `json:"appProtocol,omitempty"` + AppProtocol *AppProtocol + + // Enables API logging for the Dapr sidecar + EnableAPILogging *bool // Boolean indicating if the Dapr side car is enabled - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool + + // Increasing max size of request body http and grpc servers parameter in MB to handle uploading of big files. Default is + // 4 MB. + HTTPMaxRequestSize *int32 + + // Dapr max size of http header read buffer in KB to handle when sending multi-KB headers. Default is 65KB. + HTTPReadBufferSize *int32 + + // Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. + LogLevel *LogLevel } // DaprComponent - Dapr Component. type DaprComponent struct { // Dapr Component resource specific properties - Properties *DaprComponentProperties `json:"properties,omitempty"` + Properties *DaprComponentProperties // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DaprComponentProperties - Dapr Component resource specific properties type DaprComponentProperties struct { // Component type - ComponentType *string `json:"componentType,omitempty"` + ComponentType *string // Boolean describing if the component errors are ignores - IgnoreErrors *bool `json:"ignoreErrors,omitempty"` + IgnoreErrors *bool // Initialization timeout - InitTimeout *string `json:"initTimeout,omitempty"` + InitTimeout *string // Component metadata - Metadata []*DaprMetadata `json:"metadata,omitempty"` + Metadata []*DaprMetadata // Names of container apps that can use this Dapr component - Scopes []*string `json:"scopes,omitempty"` + Scopes []*string + + // Name of a Dapr component to retrieve component secrets from + SecretStoreComponent *string // Collection of secrets used by a Dapr component - Secrets []*Secret `json:"secrets,omitempty"` + Secrets []*Secret // Component version - Version *string `json:"version,omitempty"` + Version *string } // DaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the DaprComponentsClient.CreateOrUpdate @@ -914,280 +1433,884 @@ type DaprComponentsClientListSecretsOptions struct { // DaprComponentsCollection - Dapr Components ARM resource. type DaprComponentsCollection struct { // REQUIRED; Collection of resources. - Value []*DaprComponent `json:"value,omitempty"` + Value []*DaprComponent // READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string +} + +// DaprConfiguration - Configuration properties Dapr component +type DaprConfiguration struct { + // READ-ONLY; The version of Dapr + Version *string } // DaprMetadata - Dapr component metadata. type DaprMetadata struct { // Metadata property name. - Name *string `json:"name,omitempty"` + Name *string // Name of the Dapr Component secret from which to pull the metadata property value. - SecretRef *string `json:"secretRef,omitempty"` + SecretRef *string // Metadata property value. - Value *string `json:"value,omitempty"` + Value *string +} + +// DaprSecret - Dapr component Secret for ListSecrets Action +type DaprSecret struct { + // READ-ONLY; Secret Name. + Name *string + + // READ-ONLY; Secret Value. + Value *string } -// DaprSecretsCollection - Dapr component Secrets Collection ARM resource. +// DaprSecretsCollection - Dapr component Secrets Collection for ListSecrets Action. type DaprSecretsCollection struct { // REQUIRED; Collection of secrets used by a Dapr component - Value []*Secret `json:"value,omitempty"` + Value []*DaprSecret } // DefaultAuthorizationPolicy - The configuration settings of the Azure Active Directory default authorization policy. type DefaultAuthorizationPolicy struct { // The configuration settings of the Azure Active Directory allowed applications. - AllowedApplications []*string `json:"allowedApplications,omitempty"` + AllowedApplications []*string // The configuration settings of the Azure Active Directory allowed principals. - AllowedPrincipals *AllowedPrincipals `json:"allowedPrincipals,omitempty"` + AllowedPrincipals *AllowedPrincipals } // DefaultErrorResponse - App Service error response. type DefaultErrorResponse struct { // READ-ONLY; Error model. - Error *DefaultErrorResponseError `json:"error,omitempty" azure:"ro"` + Error *DefaultErrorResponseError } // DefaultErrorResponseError - Error model. type DefaultErrorResponseError struct { // Details or the error - Details []*DefaultErrorResponseErrorDetailsItem `json:"details,omitempty"` + Details []*DefaultErrorResponseErrorDetailsItem // READ-ONLY; Standardized string to programmatically identify the error. - Code *string `json:"code,omitempty" azure:"ro"` + Code *string // READ-ONLY; More information to debug error. - Innererror *string `json:"innererror,omitempty" azure:"ro"` + Innererror *string + + // READ-ONLY; Detailed error description and debugging information. + Message *string + + // READ-ONLY; Detailed error description and debugging information. + Target *string +} + +// DefaultErrorResponseErrorDetailsItem - Detailed errors. +type DefaultErrorResponseErrorDetailsItem struct { + // READ-ONLY; Standardized string to programmatically identify the error. + Code *string + + // READ-ONLY; Detailed error description and debugging information. + Message *string + + // READ-ONLY; Detailed error description and debugging information. + Target *string +} + +// DiagnosticDataProviderMetadata - Details of a diagnostics data provider +type DiagnosticDataProviderMetadata struct { + // Collection of properties + PropertyBag []*DiagnosticDataProviderMetadataPropertyBagItem + + // Name of data provider + ProviderName *string +} + +// DiagnosticDataProviderMetadataPropertyBagItem - Property details +type DiagnosticDataProviderMetadataPropertyBagItem struct { + // Property name + Name *string + + // Property value + Value *string +} + +// DiagnosticDataTableResponseColumn - Diagnostics data column +type DiagnosticDataTableResponseColumn struct { + // Column name + ColumnName *string + + // Column type + ColumnType *string + + // Data type of the column + DataType *string +} + +// DiagnosticDataTableResponseObject - Diagnostics data table +type DiagnosticDataTableResponseObject struct { + // Columns in the table + Columns []*DiagnosticDataTableResponseColumn + + // Rows in the table + Rows []any + + // Table name + TableName *string +} + +// DiagnosticRendering - Rendering details of a diagnostics table +type DiagnosticRendering struct { + // Description of the table + Description *string + + // Flag if the table should be rendered + IsVisible *bool + + // Title of the table + Title *string + + // Rendering type + Type *int32 +} + +// DiagnosticSupportTopic - Support topic information +type DiagnosticSupportTopic struct { + // READ-ONLY; Unique topic identifier + ID *string + + // READ-ONLY; PES identifier + PesID *string +} + +// Diagnostics data for a resource. +type Diagnostics struct { + // Diagnostics resource specific properties + Properties *DiagnosticsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DiagnosticsCollection - Diagnostics data collection for a resource. +type DiagnosticsCollection struct { + // REQUIRED; Collection of diagnostic data. + Value []*Diagnostics + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// DiagnosticsDataAPIResponse - Diagnostics data returned from a detector +type DiagnosticsDataAPIResponse struct { + // Details of the table response + RenderingProperties *DiagnosticRendering + + // Table response + Table *DiagnosticDataTableResponseObject +} + +// DiagnosticsDefinition - Metadata of the diagnostics response +type DiagnosticsDefinition struct { + // List of analysis types + AnalysisTypes []*string + + // List of support topics + SupportTopicList []*DiagnosticSupportTopic + + // READ-ONLY; Authors' names of the detector + Author *string + + // READ-ONLY; Category of the detector + Category *string + + // READ-ONLY; Details of the diagnostics info + Description *string + + // READ-ONLY; Unique detector name + ID *string + + // READ-ONLY; Display Name of the detector + Name *string + + // READ-ONLY; Authors' names of the detector + Score *float32 + + // READ-ONLY; Authors' names of the detector + Type *string +} + +// DiagnosticsProperties - Diagnostics resource specific properties +type DiagnosticsProperties struct { + // List of data providers' metadata. + DataProviderMetadata *DiagnosticDataProviderMetadata + + // Set of data collections associated with the response. + Dataset []*DiagnosticsDataAPIResponse + + // Metadata of the diagnostics response. + Metadata *DiagnosticsDefinition + + // Status of the diagnostics response. + Status *DiagnosticsStatus +} + +// DiagnosticsStatus - Rendering details of a diagnostics table +type DiagnosticsStatus struct { + // Diagnostic message + Message *string + + // Status + StatusID *int32 +} + +// EnvironmentAuthToken - Environment Auth Token. +type EnvironmentAuthToken struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Environment auth token resource specific properties + Properties *EnvironmentAuthTokenProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EnvironmentAuthTokenProperties - Environment auth token resource specific properties +type EnvironmentAuthTokenProperties struct { + // READ-ONLY; Token expiration date. + Expires *time.Time + + // READ-ONLY; Auth token value. + Token *string +} + +// EnvironmentVar - Container App container environment variable. +type EnvironmentVar struct { + // Environment variable name. + Name *string + + // Name of the Container App secret from which to pull the environment variable value. + SecretRef *string + + // Non-secret environment variable value. + Value *string +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail +} + +// ExtendedLocation - The complex type of the extended location. +type ExtendedLocation struct { + // The name of the extended location. + Name *string + + // The type of the extended location. + Type *ExtendedLocationTypes +} + +// Facebook - The configuration settings of the Facebook provider. +type Facebook struct { + // false if the Facebook provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool + + // The version of the Facebook api to be used while logging in. + GraphAPIVersion *string + + // The configuration settings of the login flow. + Login *LoginScopes + + // The configuration settings of the app registration for the Facebook provider. + Registration *AppRegistration +} + +// ForwardProxy - The configuration settings of a forward proxy used to make the requests. +type ForwardProxy struct { + // The convention used to determine the url of the request made. + Convention *ForwardProxyConvention + + // The name of the header containing the host of the request. + CustomHostHeaderName *string + + // The name of the header containing the scheme of the request. + CustomProtoHeaderName *string +} + +// GitHub - The configuration settings of the GitHub provider. +type GitHub struct { + // false if the GitHub provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool + + // The configuration settings of the login flow. + Login *LoginScopes + + // The configuration settings of the app registration for the GitHub provider. + Registration *ClientRegistration +} + +// GithubActionConfiguration - Configuration properties that define the mutable settings of a Container App SourceControl +type GithubActionConfiguration struct { + // AzureCredentials configurations. + AzureCredentials *AzureCredentials + + // Context path + ContextPath *string + + // Image name + Image *string + + // Operation system + OS *string + + // Code or Image + PublishType *string + + // Registry configurations. + RegistryInfo *RegistryInfo + + // Runtime stack + RuntimeStack *string + + // Runtime version + RuntimeVersion *string +} + +// GlobalValidation - The configuration settings that determines the validation flow of users using ContainerApp Service Authentication/Authorization. +type GlobalValidation struct { + // The paths for which unauthenticated flow would not be redirected to the login page. + ExcludedPaths []*string + + // 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 + + // The action to take when an unauthenticated client attempts to access the app. + UnauthenticatedClientAction *UnauthenticatedClientActionV2 +} + +// Google - The configuration settings of the Google provider. +type Google struct { + // false if the Google provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool + + // The configuration settings of the login flow. + Login *LoginScopes + + // The configuration settings of the app registration for the Google provider. + Registration *ClientRegistration + + // The configuration settings of the Azure Active Directory token validation flow. + Validation *AllowedAudiencesValidation +} + +// HTTPScaleRule - Container App container Http scaling rule. +type HTTPScaleRule struct { + // Authentication secrets for the custom scale rule. + Auth []*ScaleRuleAuth + + // Metadata properties to describe http scale rule. + Metadata map[string]*string +} + +// HTTPSettings - The configuration settings of the HTTP requests for authentication and authorization requests made against +// ContainerApp Service Authentication/Authorization. +type HTTPSettings struct { + // The configuration settings of a forward proxy used to make the requests. + ForwardProxy *ForwardProxy + + // false if the authentication/authorization responses not having the HTTPS scheme are permissible; otherwise, true. + RequireHTTPS *bool + + // The configuration settings of the paths HTTP requests. + Routes *HTTPSettingsRoutes +} + +// HTTPSettingsRoutes - The configuration settings of the paths HTTP requests. +type HTTPSettingsRoutes struct { + // The prefix that should precede all the authentication/authorization paths. + APIPrefix *string +} + +// IPSecurityRestrictionRule - Rule to restrict incoming IP address. +type IPSecurityRestrictionRule struct { + // REQUIRED; Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of ALL Allow or ALL Deny + Action *Action + + // REQUIRED; CIDR notation to match incoming IP address + IPAddressRange *string + + // REQUIRED; Name for the IP restriction rule. + Name *string + + // Describe the IP restriction rule that is being sent to the container-app. This is an optional field. + Description *string +} + +// IdentityProviders - The configuration settings of each of the identity providers used to configure ContainerApp Service +// Authentication/Authorization. +type IdentityProviders struct { + // The configuration settings of the Apple provider. + Apple *Apple + + // The configuration settings of the Azure Active directory provider. + AzureActiveDirectory *AzureActiveDirectory + + // The configuration settings of the Azure Static Web Apps provider. + AzureStaticWebApps *AzureStaticWebApps + + // 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 + + // The configuration settings of the Facebook provider. + Facebook *Facebook + + // The configuration settings of the GitHub provider. + GitHub *GitHub + + // The configuration settings of the Google provider. + Google *Google + + // The configuration settings of the Twitter provider. + Twitter *Twitter +} + +// 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 + + // Client certificate mode for mTLS authentication. Ignore indicates server drops client certificate on forwarding. Accept + // indicates server forwards client certificate but does not require a client + // certificate. Require indicates server requires a client certificate. + ClientCertificateMode *IngressClientCertificateMode + + // CORS policy for container app + CorsPolicy *CorsPolicy + + // custom domain bindings for Container Apps' hostnames. + CustomDomains []*CustomDomain + + // Exposed Port in containers for TCP traffic from ingress + ExposedPort *int32 + + // Bool indicating if app exposes an external http endpoint + External *bool + + // Rules to restrict incoming IP address. + IPSecurityRestrictions []*IPSecurityRestrictionRule + + // Sticky Sessions for Single Revision Mode + StickySessions *IngressStickySessions + + // Target Port in containers for traffic from ingress + TargetPort *int32 + + // Traffic weights for app's revisions + Traffic []*TrafficWeight + + // Ingress transport protocol + Transport *IngressTransportMethod + + // READ-ONLY; Hostname. + Fqdn *string +} + +// IngressStickySessions - Sticky Sessions for Single Revision Mode +type IngressStickySessions struct { + // Sticky Session Affinity + Affinity *Affinity +} + +// InitContainer - Container App init container definition +type InitContainer struct { + // Container start command arguments. + Args []*string + + // Container start command. + Command []*string + + // Container environment variables. + Env []*EnvironmentVar + + // Container image tag. + Image *string + + // Custom container name. + Name *string + + // Container resource requirements. + Resources *ContainerResources + + // Container volume mounts. + VolumeMounts []*VolumeMount +} + +// Job - Container App Job +type Job struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials + // in code. + Identity *ManagedServiceIdentity + + // Container Apps Job resource specific properties. + Properties *JobProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// JobConfiguration - Non versioned Container Apps Job configuration properties +type JobConfiguration struct { + // REQUIRED; Maximum number of seconds a replica is allowed to run. + ReplicaTimeout *int32 + + // REQUIRED; Trigger type of the job + TriggerType *TriggerType + + // Manual trigger configuration for a single execution job. Properties replicaCompletionCount and parallelism would be set + // to 1 by default + ManualTriggerConfig *JobConfigurationManualTriggerConfig + + // Collection of private container registry credentials used by a Container apps job + Registries []*RegistryCredentials + + // Maximum number of retries before failing the job. + ReplicaRetryLimit *int32 - // READ-ONLY; Detailed error description and debugging information. - Message *string `json:"message,omitempty" azure:"ro"` + // Cron formatted repeating trigger schedule ("* * * * *") for cronjobs. Properties completions and parallelism would be set + // to 1 by default + ScheduleTriggerConfig *JobConfigurationScheduleTriggerConfig - // READ-ONLY; Detailed error description and debugging information. - Target *string `json:"target,omitempty" azure:"ro"` + // Collection of secrets used by a Container Apps Job + Secrets []*Secret } -// 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"` +// JobConfigurationManualTriggerConfig - Manual trigger configuration for a single execution job. Properties replicaCompletionCount +// and parallelism would be set to 1 by default +type JobConfigurationManualTriggerConfig struct { + // Number of parallel replicas of a job that can run at a given time. + Parallelism *int32 - // READ-ONLY; Detailed error description and debugging information. - Target *string `json:"target,omitempty" azure:"ro"` + // Minimum number of successful replica completions before overall job completion. + ReplicaCompletionCount *int32 } -// EnvironmentVar - Container App container environment variable. -type EnvironmentVar struct { - // Environment variable name. - Name *string `json:"name,omitempty"` +// JobConfigurationScheduleTriggerConfig - Cron formatted repeating trigger schedule ("* * * * *") for cronjobs. Properties +// completions and parallelism would be set to 1 by default +type JobConfigurationScheduleTriggerConfig struct { + // REQUIRED; Cron formatted repeating schedule ("* * * * *") of a Cron Job. + CronExpression *string - // Name of the Container App secret from which to pull the environment variable value. - SecretRef *string `json:"secretRef,omitempty"` + // Number of parallel replicas of a job that can run at a given time. + Parallelism *int32 - // Non-secret environment variable value. - Value *string `json:"value,omitempty"` + // Minimum number of successful replica completions before overall job completion. + ReplicaCompletionCount *int32 } -// Facebook - The configuration settings of the Facebook provider. -type Facebook struct { - // false if the Facebook provider should not be enabled despite the set registration; otherwise, true. - Enabled *bool `json:"enabled,omitempty"` +// JobExecution - Container Apps Jobs execution. +type JobExecution struct { + // Job execution start time. + EndTime *time.Time - // The version of the Facebook api to be used while logging in. - GraphAPIVersion *string `json:"graphApiVersion,omitempty"` + // Job execution Id. + ID *string - // The configuration settings of the login flow. - Login *LoginScopes `json:"login,omitempty"` + // Job execution Name. + Name *string - // The configuration settings of the app registration for the Facebook provider. - Registration *AppRegistration `json:"registration,omitempty"` -} + // Job execution start time. + StartTime *time.Time -// ForwardProxy - The configuration settings of a forward proxy used to make the requests. -type ForwardProxy struct { - // The convention used to determine the url of the request made. - Convention *ForwardProxyConvention `json:"convention,omitempty"` + // Job's execution container. + Template *JobExecutionTemplate - // The name of the header containing the host of the request. - CustomHostHeaderName *string `json:"customHostHeaderName,omitempty"` + // Job Type. + Type *string - // The name of the header containing the scheme of the request. - CustomProtoHeaderName *string `json:"customProtoHeaderName,omitempty"` + // READ-ONLY; Current running State of the job + Status *JobExecutionRunningState } -// GitHub - The configuration settings of the GitHub provider. -type GitHub struct { - // false if the GitHub provider should not be enabled despite the set registration; otherwise, true. - Enabled *bool `json:"enabled,omitempty"` - - // The configuration settings of the login flow. - Login *LoginScopes `json:"login,omitempty"` +// JobExecutionBase - Container App's Job execution name. +type JobExecutionBase struct { + // Job execution Id. + ID *string - // The configuration settings of the app registration for the GitHub provider. - Registration *ClientRegistration `json:"registration,omitempty"` + // Job execution name. + Name *string } -// GithubActionConfiguration - Configuration properties that define the mutable settings of a Container App SourceControl -type GithubActionConfiguration struct { - // AzureCredentials configurations. - AzureCredentials *AzureCredentials `json:"azureCredentials,omitempty"` - - // Context path - ContextPath *string `json:"contextPath,omitempty"` +// JobExecutionContainer - Container Apps Jobs execution container definition. +type JobExecutionContainer struct { + // Container start command arguments. + Args []*string - // Image name - Image *string `json:"image,omitempty"` + // Container start command. + Command []*string - // Operation system - OS *string `json:"os,omitempty"` + // Container environment variables. + Env []*EnvironmentVar - // Code or Image - PublishType *string `json:"publishType,omitempty"` + // Container image tag. + Image *string - // Registry configurations. - RegistryInfo *RegistryInfo `json:"registryInfo,omitempty"` + // Custom container name. + Name *string - // Runtime stack - RuntimeStack *string `json:"runtimeStack,omitempty"` + // Container resource requirements. + Resources *ContainerResources +} - // Runtime version - RuntimeVersion *string `json:"runtimeVersion,omitempty"` +// JobExecutionNamesCollection - Container App executions names list. +type JobExecutionNamesCollection struct { + // REQUIRED; Collection of resources. + Value []*JobExecutionBase } -// GlobalValidation - The configuration settings that determines the validation flow of users using ContainerApp Service Authentication/Authorization. -type GlobalValidation struct { - // The paths for which unauthenticated flow would not be redirected to the login page. - ExcludedPaths []*string `json:"excludedPaths,omitempty"` +// JobExecutionTemplate - Job's execution template, containing container configuration for a job's execution +type JobExecutionTemplate struct { + // List of container definitions for the Container Apps Job. + Containers []*JobExecutionContainer - // 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"` + // List of specialized containers that run before job containers. + InitContainers []*JobExecutionContainer +} - // The action to take when an unauthenticated client attempts to access the app. - UnauthenticatedClientAction *UnauthenticatedClientActionV2 `json:"unauthenticatedClientAction,omitempty"` +// JobPatchProperties - Container Apps Job resource specific properties. +type JobPatchProperties struct { + // Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials + // in code. + Identity *ManagedServiceIdentity + Properties *JobPatchPropertiesProperties + + // Resource tags. + Tags map[string]*string } -// Google - The configuration settings of the Google provider. -type Google struct { - // false if the Google provider should not be enabled despite the set registration; otherwise, true. - Enabled *bool `json:"enabled,omitempty"` +type JobPatchPropertiesProperties struct { + // Container Apps Job configuration properties. + Configuration *JobConfiguration - // The configuration settings of the login flow. - Login *LoginScopes `json:"login,omitempty"` + // Resource ID of environment. + EnvironmentID *string - // The configuration settings of the app registration for the Google provider. - Registration *ClientRegistration `json:"registration,omitempty"` + // The endpoint of the eventstream of the container apps job. + EventStreamEndpoint *string - // The configuration settings of the Azure Active Directory token validation flow. - Validation *AllowedAudiencesValidation `json:"validation,omitempty"` + // Outbound IP Addresses of a container apps job. + OutboundIPAddresses []*string + + // Container Apps job definition. + Template *JobTemplate } -// HTTPScaleRule - Container App container Custom scaling rule. -type HTTPScaleRule struct { - // Authentication secrets for the custom scale rule. - Auth []*ScaleRuleAuth `json:"auth,omitempty"` +// JobProperties - Container Apps Job resource specific properties. +type JobProperties struct { + // Container Apps Job configuration properties. + Configuration *JobConfiguration - // Metadata properties to describe http scale rule. - Metadata map[string]*string `json:"metadata,omitempty"` -} + // Resource ID of environment. + EnvironmentID *string -// HTTPSettings - The configuration settings of the HTTP requests for authentication and authorization requests made against -// ContainerApp Service Authentication/Authorization. -type HTTPSettings struct { - // The configuration settings of a forward proxy used to make the requests. - ForwardProxy *ForwardProxy `json:"forwardProxy,omitempty"` + // Container Apps job definition. + Template *JobTemplate - // false if the authentication/authorization responses not having the HTTPS scheme are permissible; otherwise, true. - RequireHTTPS *bool `json:"requireHttps,omitempty"` + // Workload profile name to pin for container apps job execution. + WorkloadProfileName *string - // The configuration settings of the paths HTTP requests. - Routes *HTTPSettingsRoutes `json:"routes,omitempty"` + // READ-ONLY; The endpoint of the eventstream of the container apps job. + EventStreamEndpoint *string + + // READ-ONLY; Outbound IP Addresses of a container apps job. + OutboundIPAddresses []*string + + // READ-ONLY; Provisioning state of the Container Apps Job. + ProvisioningState *JobProvisioningState } -// HTTPSettingsRoutes - The configuration settings of the paths HTTP requests. -type HTTPSettingsRoutes struct { - // The prefix that should precede all the authentication/authorization paths. - APIPrefix *string `json:"apiPrefix,omitempty"` +// JobSecretsCollection - Container Apps Job Secrets Collection ARM resource. +type JobSecretsCollection struct { + // REQUIRED; Collection of resources. + Value []*Secret } -// IdentityProviders - The configuration settings of each of the identity providers used to configure ContainerApp Service -// Authentication/Authorization. -type IdentityProviders struct { - // The configuration settings of the Apple provider. - Apple *Apple `json:"apple,omitempty"` +// JobTemplate - Container Apps Job 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 JobTemplate struct { + // List of container definitions for the Container App. + Containers []*Container - // The configuration settings of the Azure Active directory provider. - AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` + // List of specialized containers that run before app containers. + InitContainers []*InitContainer - // The configuration settings of the Azure Static Web Apps provider. - AzureStaticWebApps *AzureStaticWebApps `json:"azureStaticWebApps,omitempty"` + // List of volume definitions for the Container App. + Volumes []*Volume +} - // 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"` +// JobsClientBeginCreateOrUpdateOptions contains the optional parameters for the JobsClient.BeginCreateOrUpdate method. +type JobsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} - // The configuration settings of the Facebook provider. - Facebook *Facebook `json:"facebook,omitempty"` +// JobsClientBeginDeleteOptions contains the optional parameters for the JobsClient.BeginDelete method. +type JobsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} - // The configuration settings of the GitHub provider. - GitHub *GitHub `json:"gitHub,omitempty"` +// JobsClientBeginStartOptions contains the optional parameters for the JobsClient.BeginStart method. +type JobsClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} - // The configuration settings of the Google provider. - Google *Google `json:"google,omitempty"` +// JobsClientBeginStopExecutionOptions contains the optional parameters for the JobsClient.BeginStopExecution method. +type JobsClientBeginStopExecutionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} - // The configuration settings of the Twitter provider. - Twitter *Twitter `json:"twitter,omitempty"` +// JobsClientBeginStopMultipleExecutionsOptions contains the optional parameters for the JobsClient.BeginStopMultipleExecutions +// method. +type JobsClientBeginStopMultipleExecutionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// 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"` +// JobsClientBeginUpdateOptions contains the optional parameters for the JobsClient.BeginUpdate method. +type JobsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} - // custom domain bindings for Container Apps' hostnames. - CustomDomains []*CustomDomain `json:"customDomains,omitempty"` +// JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +type JobsClientGetOptions struct { + // placeholder for future optional parameters +} - // Bool indicating if app exposes an external http endpoint - External *bool `json:"external,omitempty"` +// JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.NewListByResourceGroupPager method. +type JobsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} - // Target Port in containers for traffic from ingress - TargetPort *int32 `json:"targetPort,omitempty"` +// JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.NewListBySubscriptionPager method. +type JobsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} - // Traffic weights for app's revisions - Traffic []*TrafficWeight `json:"traffic,omitempty"` +// JobsClientListSecretsOptions contains the optional parameters for the JobsClient.ListSecrets method. +type JobsClientListSecretsOptions struct { + // placeholder for future optional parameters +} - // Ingress transport protocol - Transport *IngressTransportMethod `json:"transport,omitempty"` +// JobsCollection - Container Apps Jobs collection ARM resource. +type JobsCollection struct { + // REQUIRED; Collection of resources. + Value []*Job - // READ-ONLY; Hostname. - Fqdn *string `json:"fqdn,omitempty" azure:"ro"` + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// JobsExecutionsClientListOptions contains the optional parameters for the JobsExecutionsClient.NewListPager method. +type JobsExecutionsClientListOptions struct { + // The filter to apply on the operation. + Filter *string } // JwtClaimChecks - The configuration settings of the checks that should be made while validating the JWT Claims. type JwtClaimChecks struct { // The list of the allowed client applications. - AllowedClientApplications []*string `json:"allowedClientApplications,omitempty"` + AllowedClientApplications []*string // The list of the allowed groups. - AllowedGroups []*string `json:"allowedGroups,omitempty"` + AllowedGroups []*string +} + +// KedaConfiguration - Configuration properties Keda component +type KedaConfiguration struct { + // READ-ONLY; The version of Keda + Version *string } // LogAnalyticsConfiguration - Log analytics configuration type LogAnalyticsConfiguration struct { // Log analytics customer id - CustomerID *string `json:"customerId,omitempty"` + CustomerID *string // Log analytics customer key - SharedKey *string `json:"sharedKey,omitempty"` + SharedKey *string } // Login - The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. @@ -1195,116 +2318,237 @@ 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"` + AllowedExternalRedirectUrls []*string // The configuration settings of the session cookie's expiration. - CookieExpiration *CookieExpiration `json:"cookieExpiration,omitempty"` + CookieExpiration *CookieExpiration // The configuration settings of the nonce used in the login flow. - Nonce *Nonce `json:"nonce,omitempty"` + Nonce *Nonce // true if the fragments from the request are preserved after the login request is made; otherwise, false. - PreserveURLFragmentsForLogins *bool `json:"preserveUrlFragmentsForLogins,omitempty"` + PreserveURLFragmentsForLogins *bool // The routes that specify the endpoints used for login and logout requests. - Routes *LoginRoutes `json:"routes,omitempty"` + Routes *LoginRoutes } // LoginRoutes - The routes that specify the endpoints used for login and logout requests. type LoginRoutes struct { // The endpoint at which a logout request should be made. - LogoutEndpoint *string `json:"logoutEndpoint,omitempty"` + LogoutEndpoint *string } // 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"` + Scopes []*string +} + +// ManagedCertificate - Managed certificates used for Custom Domain bindings of Container Apps in a Managed Environment +type ManagedCertificate struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Certificate resource specific properties + Properties *ManagedCertificateProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ManagedCertificateCollection - Collection of Managed Certificates. +type ManagedCertificateCollection struct { + // REQUIRED; Collection of resources. + Value []*ManagedCertificate + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// ManagedCertificatePatch - A managed certificate to update +type ManagedCertificatePatch struct { + // Application-specific metadata in the form of key-value pairs. + Tags map[string]*string +} + +// ManagedCertificateProperties - Certificate resource specific properties +type ManagedCertificateProperties struct { + // Selected type of domain control validation for managed certificates. + DomainControlValidation *ManagedCertificateDomainControlValidation + + // Subject name of the certificate. + SubjectName *string + + // READ-ONLY; Any error occurred during the certificate provision. + Error *string + + // READ-ONLY; Provisioning state of the certificate. + ProvisioningState *CertificateProvisioningState + + // READ-ONLY; A TXT token used for DNS TXT domain control validation when issuing this type of managed certificates. + ValidationToken *string +} + +// ManagedCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedCertificatesClient.BeginCreateOrUpdate +// method. +type ManagedCertificatesClientBeginCreateOrUpdateOptions struct { + // Managed Certificate to be created or updated + ManagedCertificateEnvelope *ManagedCertificate + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedCertificatesClientDeleteOptions contains the optional parameters for the ManagedCertificatesClient.Delete method. +type ManagedCertificatesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagedCertificatesClientGetOptions contains the optional parameters for the ManagedCertificatesClient.Get method. +type ManagedCertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedCertificatesClientListOptions contains the optional parameters for the ManagedCertificatesClient.NewListPager method. +type ManagedCertificatesClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedCertificatesClientUpdateOptions contains the optional parameters for the ManagedCertificatesClient.Update method. +type ManagedCertificatesClientUpdateOptions struct { + // placeholder for future optional parameters } // ManagedEnvironment - An environment for hosting container apps type ManagedEnvironment struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string + + // Kind of the Environment. + Kind *string // Managed environment resource specific properties - Properties *ManagedEnvironmentProperties `json:"properties,omitempty"` + Properties *ManagedEnvironmentProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string +} + +// ManagedEnvironmentDiagnosticsClientGetDetectorOptions contains the optional parameters for the ManagedEnvironmentDiagnosticsClient.GetDetector +// method. +type ManagedEnvironmentDiagnosticsClientGetDetectorOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentDiagnosticsClientListDetectorsOptions contains the optional parameters for the ManagedEnvironmentDiagnosticsClient.ListDetectors +// method. +type ManagedEnvironmentDiagnosticsClientListDetectorsOptions struct { + // placeholder for future optional parameters } // ManagedEnvironmentProperties - Managed environment resource specific properties type ManagedEnvironmentProperties struct { // Cluster configuration which enables the log daemon to export app logs to a destination. Currently only "log-analytics" // is supported - AppLogsConfiguration *AppLogsConfiguration `json:"appLogsConfiguration,omitempty"` + AppLogsConfiguration *AppLogsConfiguration + + // Custom domain configuration for the environment + CustomDomainConfiguration *CustomDomainConfiguration // Application Insights connection string used by Dapr to export Service to Service communication telemetry - DaprAIConnectionString *string `json:"daprAIConnectionString,omitempty"` + DaprAIConnectionString *string // Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry - DaprAIInstrumentationKey *string `json:"daprAIInstrumentationKey,omitempty"` + DaprAIInstrumentationKey *string + + // The configuration of Dapr component. + DaprConfiguration *DaprConfiguration + + // Name of the platform-managed resource group created for the Managed Environment to host infrastructure resources. If a + // subnet ID is provided, this resource group will be created in the same + // subscription as the subnet. + InfrastructureResourceGroup *string + + // The configuration of Keda component. + KedaConfiguration *KedaConfiguration // Vnet configuration for the environment - VnetConfiguration *VnetConfiguration `json:"vnetConfiguration,omitempty"` + VnetConfiguration *VnetConfiguration + + // Workload profiles configured for the Managed Environment. + WorkloadProfiles []*WorkloadProfile // Whether or not this Managed Environment is zone-redundant. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + ZoneRedundant *bool // READ-ONLY; Default Domain Name for the cluster - DefaultDomain *string `json:"defaultDomain,omitempty" azure:"ro"` + DefaultDomain *string // READ-ONLY; Any errors that occurred during deployment or deployment validation - DeploymentErrors *string `json:"deploymentErrors,omitempty" azure:"ro"` + DeploymentErrors *string + + // READ-ONLY; The endpoint of the eventstream of the Environment. + EventStreamEndpoint *string // READ-ONLY; Provisioning state of the Environment. - ProvisioningState *EnvironmentProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *EnvironmentProvisioningState // READ-ONLY; Static IP of the Environment - StaticIP *string `json:"staticIp,omitempty" azure:"ro"` + StaticIP *string } // ManagedEnvironmentStorage - Storage resource for managedEnvironment. type ManagedEnvironmentStorage struct { // Storage properties - Properties *ManagedEnvironmentStorageProperties `json:"properties,omitempty"` + Properties *ManagedEnvironmentStorageProperties // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedEnvironmentStorageProperties - Storage properties type ManagedEnvironmentStorageProperties struct { // Azure file properties - AzureFile *AzureFileProperties `json:"azureFile,omitempty"` + AzureFile *AzureFileProperties } // ManagedEnvironmentStoragesCollection - Collection of Storage for Environments type ManagedEnvironmentStoragesCollection struct { // REQUIRED; Collection of storage resources. - Value []*ManagedEnvironmentStorage `json:"value,omitempty"` + Value []*ManagedEnvironmentStorage } // ManagedEnvironmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedEnvironmentsClient.BeginCreateOrUpdate @@ -1328,6 +2572,12 @@ type ManagedEnvironmentsClientBeginUpdateOptions struct { ResumeToken string } +// ManagedEnvironmentsClientGetAuthTokenOptions contains the optional parameters for the ManagedEnvironmentsClient.GetAuthToken +// method. +type ManagedEnvironmentsClientGetAuthTokenOptions struct { + // placeholder for future optional parameters +} + // ManagedEnvironmentsClientGetOptions contains the optional parameters for the ManagedEnvironmentsClient.Get method. type ManagedEnvironmentsClientGetOptions struct { // placeholder for future optional parameters @@ -1345,13 +2595,25 @@ type ManagedEnvironmentsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } +// ManagedEnvironmentsClientListWorkloadProfileStatesOptions contains the optional parameters for the ManagedEnvironmentsClient.NewListWorkloadProfileStatesPager +// method. +type ManagedEnvironmentsClientListWorkloadProfileStatesOptions struct { + // placeholder for future optional parameters +} + // ManagedEnvironmentsCollection - Collection of Environments type ManagedEnvironmentsCollection struct { // REQUIRED; Collection of resources. - Value []*ManagedEnvironment `json:"value,omitempty"` + Value []*ManagedEnvironment // READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string +} + +// ManagedEnvironmentsDiagnosticsClientGetRootOptions contains the optional parameters for the ManagedEnvironmentsDiagnosticsClient.GetRoot +// method. +type ManagedEnvironmentsDiagnosticsClientGetRootOptions struct { + // placeholder for future optional parameters } // ManagedEnvironmentsStoragesClientCreateOrUpdateOptions contains the optional parameters for the ManagedEnvironmentsStoragesClient.CreateOrUpdate @@ -1381,21 +2643,21 @@ type ManagedEnvironmentsStoragesClientListOptions struct { // 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"` + Type *ManagedServiceIdentityType // 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"` + UserAssignedIdentities map[string]*UserAssignedIdentity // 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"` + PrincipalID *string // 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"` + TenantID *string } // NamespacesClientCheckNameAvailabilityOptions contains the optional parameters for the NamespacesClient.CheckNameAvailability @@ -1407,88 +2669,88 @@ type NamespacesClientCheckNameAvailabilityOptions struct { // Nonce - The configuration settings of the nonce used in the login flow. type Nonce struct { // The time after the request is made when the nonce should expire. - NonceExpirationInterval *string `json:"nonceExpirationInterval,omitempty"` + NonceExpirationInterval *string // false if the nonce should not be validated while completing the login flow; otherwise, true. - ValidateNonce *bool `json:"validateNonce,omitempty"` + ValidateNonce *bool } // OpenIDConnectClientCredential - The authentication client credentials of the custom Open ID Connect provider. type OpenIDConnectClientCredential struct { // The app setting that contains the client secret for the custom Open ID Connect provider. - ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` + ClientSecretSettingName *string // The method that should be used to authenticate the user. - Method *string `json:"method,omitempty"` + Method *string } // 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"` + AuthorizationEndpoint *string // The endpoint that provides the keys necessary to validate the token. - CertificationURI *string `json:"certificationUri,omitempty"` + CertificationURI *string // The endpoint that issues the token. - Issuer *string `json:"issuer,omitempty"` + Issuer *string // The endpoint to be used to request a token. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` + TokenEndpoint *string // The endpoint that contains all the configuration endpoints for the provider. - WellKnownOpenIDConfiguration *string `json:"wellKnownOpenIdConfiguration,omitempty"` + WellKnownOpenIDConfiguration *string } // 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"` + NameClaimType *string // A list of the scopes that should be requested while authenticating. - Scopes []*string `json:"scopes,omitempty"` + Scopes []*string } // 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"` + ClientCredential *OpenIDConnectClientCredential // The client id of the custom Open ID Connect provider. - ClientID *string `json:"clientId,omitempty"` + ClientID *string // The configuration settings of the endpoints used for the custom Open ID Connect provider. - OpenIDConnectConfiguration *OpenIDConnectConfig `json:"openIdConnectConfiguration,omitempty"` + OpenIDConnectConfiguration *OpenIDConnectConfig } // OperationDetail - Operation detail payload type OperationDetail struct { // Display of the operation - Display *OperationDisplay `json:"display,omitempty"` + Display *OperationDisplay // Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` + IsDataAction *bool // Name of the operation - Name *string `json:"name,omitempty"` + Name *string // Origin of the operation - Origin *string `json:"origin,omitempty"` + Origin *string } // OperationDisplay - Operation display payload type OperationDisplay struct { // Localized friendly description for the operation - Description *string `json:"description,omitempty"` + Description *string // Localized friendly name for the operation - Operation *string `json:"operation,omitempty"` + Operation *string // Resource provider of the operation - Provider *string `json:"provider,omitempty"` + Provider *string // Resource of the operation - Resource *string `json:"resource,omitempty"` + Resource *string } // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. @@ -1500,422 +2762,511 @@ type OperationsClientListOptions struct { // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // QueueScaleRule - Container App container Azure Queue based scaling rule. type QueueScaleRule struct { // Authentication secrets for the queue scale rule. - Auth []*ScaleRuleAuth `json:"auth,omitempty"` + Auth []*ScaleRuleAuth // Queue length. - QueueLength *int32 `json:"queueLength,omitempty"` + QueueLength *int32 // Queue name. - QueueName *string `json:"queueName,omitempty"` + QueueName *string } // RegistryCredentials - Container App Private Registry type RegistryCredentials struct { // A Managed Identity to use to authenticate with Azure Container Registry. For user-assigned identities, use the full user-assigned // identity Resource ID. For system-assigned identities, use 'system' - Identity *string `json:"identity,omitempty"` + Identity *string // The name of the Secret that contains the registry login password - PasswordSecretRef *string `json:"passwordSecretRef,omitempty"` + PasswordSecretRef *string // Container Registry Server - Server *string `json:"server,omitempty"` + Server *string // Container Registry Username - Username *string `json:"username,omitempty"` + Username *string } // RegistryInfo - Container App registry information. type RegistryInfo struct { // registry secret. - RegistryPassword *string `json:"registryPassword,omitempty"` + RegistryPassword *string // registry server Url. - RegistryURL *string `json:"registryUrl,omitempty"` + RegistryURL *string // registry username. - RegistryUserName *string `json:"registryUserName,omitempty"` + RegistryUserName *string } // Replica - Container App Revision Replica. type Replica struct { // Replica resource specific properties - Properties *ReplicaProperties `json:"properties,omitempty"` + Properties *ReplicaProperties // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ReplicaCollection - Container App Revision Replicas collection ARM resource. type ReplicaCollection struct { // REQUIRED; Collection of resources. - Value []*Replica `json:"value,omitempty"` + Value []*Replica } // ReplicaContainer - Container object under Container App Revision Replica. type ReplicaContainer struct { // The Id of the Container - ContainerID *string `json:"containerId,omitempty"` + ContainerID *string // The Name of the Container - Name *string `json:"name,omitempty"` + Name *string // The container ready status - Ready *bool `json:"ready,omitempty"` + Ready *bool // The container restart count - RestartCount *int32 `json:"restartCount,omitempty"` + RestartCount *int32 // The container start status - Started *bool `json:"started,omitempty"` + Started *bool + + // READ-ONLY; Container exec endpoint + ExecEndpoint *string + + // READ-ONLY; Log Stream endpoint + LogStreamEndpoint *string } // ReplicaProperties - Replica resource specific properties type ReplicaProperties struct { // The containers collection under a replica. - Containers []*ReplicaContainer `json:"containers,omitempty"` + Containers []*ReplicaContainer // READ-ONLY; Timestamp describing when the pod was created by controller - CreatedTime *time.Time `json:"createdTime,omitempty" azure:"ro"` + CreatedTime *time.Time } // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // Revision - Container App Revision. type Revision struct { // Revision resource specific properties - Properties *RevisionProperties `json:"properties,omitempty"` + Properties *RevisionProperties // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // RevisionCollection - Container App Revisions collection ARM resource. type RevisionCollection struct { // REQUIRED; Collection of resources. - Value []*Revision `json:"value,omitempty"` + Value []*Revision // READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // RevisionProperties - Revision resource specific properties type RevisionProperties struct { // READ-ONLY; Boolean describing if the Revision is Active - Active *bool `json:"active,omitempty" azure:"ro"` + Active *bool // READ-ONLY; Timestamp describing when the revision was created by controller - CreatedTime *time.Time `json:"createdTime,omitempty" azure:"ro"` + CreatedTime *time.Time // READ-ONLY; Fully qualified domain name of the revision - Fqdn *string `json:"fqdn,omitempty" azure:"ro"` + Fqdn *string // READ-ONLY; Current health State of the revision - HealthState *RevisionHealthState `json:"healthState,omitempty" azure:"ro"` + HealthState *RevisionHealthState + + // READ-ONLY; Timestamp describing when the revision was last active. Only meaningful when revision is inactive + LastActiveTime *time.Time // READ-ONLY; Optional Field - Platform Error Message - ProvisioningError *string `json:"provisioningError,omitempty" azure:"ro"` + ProvisioningError *string // READ-ONLY; Current provisioning State of the revision - ProvisioningState *RevisionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *RevisionProvisioningState // READ-ONLY; Number of pods currently running for this revision - Replicas *int32 `json:"replicas,omitempty" azure:"ro"` + Replicas *int32 // 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"` + Template *Template // READ-ONLY; Traffic weight assigned to this revision - TrafficWeight *int32 `json:"trafficWeight,omitempty" azure:"ro"` + TrafficWeight *int32 } // 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"` + MaxReplicas *int32 // Optional. Minimum number of container replicas. - MinReplicas *int32 `json:"minReplicas,omitempty"` + MinReplicas *int32 // Scaling rules. - Rules []*ScaleRule `json:"rules,omitempty"` + Rules []*ScaleRule } // ScaleRule - Container App container scaling rule. type ScaleRule struct { // Azure Queue based scaling. - AzureQueue *QueueScaleRule `json:"azureQueue,omitempty"` + AzureQueue *QueueScaleRule // Custom scale rule. - Custom *CustomScaleRule `json:"custom,omitempty"` + Custom *CustomScaleRule // HTTP requests based scaling. - HTTP *HTTPScaleRule `json:"http,omitempty"` + HTTP *HTTPScaleRule // Scale Rule Name - Name *string `json:"name,omitempty"` + Name *string + + // Tcp requests based scaling. + TCP *TCPScaleRule } // 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"` + SecretRef *string // Trigger Parameter that uses the secret - TriggerParameter *string `json:"triggerParameter,omitempty"` + TriggerParameter *string } // Secret definition. type Secret struct { + // Resource ID of a managed identity to authenticate with Azure Key Vault, or System to use a system-assigned identity. + Identity *string + + // Azure Key Vault URL pointing to the secret referenced by the container app. + KeyVaultURL *string + // Secret Name. - Name *string `json:"name,omitempty"` + Name *string // Secret Value. - Value *string `json:"value,omitempty"` + Value *string +} + +// SecretVolumeItem - Secret to be added to volume. +type SecretVolumeItem struct { + // Path to project secret to. If no path is provided, path defaults to name of secret listed in secretRef. + Path *string + + // Name of the Container App secret from which to pull the secret value. + SecretRef *string } // SecretsCollection - Container App Secrets Collection ARM resource. type SecretsCollection struct { // REQUIRED; Collection of resources. - Value []*ContainerAppSecret `json:"value,omitempty"` + Value []*ContainerAppSecret } // SourceControl - Container App SourceControl. type SourceControl struct { // SourceControl resource specific properties - Properties *SourceControlProperties `json:"properties,omitempty"` + Properties *SourceControlProperties // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SourceControlCollection - SourceControl collection ARM resource. type SourceControlCollection struct { // REQUIRED; Collection of resources. - Value []*SourceControl `json:"value,omitempty"` + Value []*SourceControl // READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // SourceControlProperties - SourceControl resource specific properties type SourceControlProperties struct { // The branch which will trigger the auto deployment - Branch *string `json:"branch,omitempty"` + Branch *string // 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"` + GithubActionConfiguration *GithubActionConfiguration // The repo url which will be integrated to ContainerApp. - RepoURL *string `json:"repoUrl,omitempty"` + RepoURL *string // READ-ONLY; Current provisioning State of the operation - OperationState *SourceControlOperationState `json:"operationState,omitempty" azure:"ro"` + OperationState *SourceControlOperationState } // 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"` + CreatedAt *time.Time // The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` + CreatedBy *string // The type of identity that created the resource. - CreatedByType *CreatedByType `json:"createdByType,omitempty"` + CreatedByType *CreatedByType // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAt *time.Time // The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedBy *string // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` + LastModifiedByType *CreatedByType +} + +// TCPScaleRule - Container App container Tcp scaling rule. +type TCPScaleRule struct { + // Authentication secrets for the tcp scale rule. + Auth []*ScaleRuleAuth + + // Metadata properties to describe tcp scale rule. + Metadata map[string]*string } // 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"` + Containers []*Container + + // List of specialized containers that run before app containers. + InitContainers []*InitContainer // User friendly suffix that is appended to the revision name - RevisionSuffix *string `json:"revisionSuffix,omitempty"` + RevisionSuffix *string // Scaling properties for the Container App. - Scale *Scale `json:"scale,omitempty"` + Scale *Scale // List of volume definitions for the Container App. - Volumes []*Volume `json:"volumes,omitempty"` + Volumes []*Volume } // 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"` + Location *string // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // 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"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // TrafficWeight - Traffic weight assigned to a revision type TrafficWeight struct { // Associates a traffic label with a revision - Label *string `json:"label,omitempty"` + Label *string // Indicates that the traffic weight belongs to a latest stable revision - LatestRevision *bool `json:"latestRevision,omitempty"` + LatestRevision *bool // Name of a revision - RevisionName *string `json:"revisionName,omitempty"` + RevisionName *string // Traffic weight assigned to a revision - Weight *int32 `json:"weight,omitempty"` + Weight *int32 } // Twitter - The configuration settings of the Twitter provider. type Twitter struct { // false if the Twitter provider should not be enabled despite the set registration; otherwise, true. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // The configuration settings of the app registration for the Twitter provider. - Registration *TwitterRegistration `json:"registration,omitempty"` + Registration *TwitterRegistration } // 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"` + ConsumerKey *string // The app setting name that contains the OAuth 1.0a consumer secret of the Twitter application used for sign-in. - ConsumerSecretSettingName *string `json:"consumerSecretSettingName,omitempty"` + ConsumerSecretSettingName *string } // UserAssignedIdentity - User assigned identity properties type UserAssignedIdentity struct { // READ-ONLY; The client ID of the assigned identity. - ClientID *string `json:"clientId,omitempty" azure:"ro"` + ClientID *string // READ-ONLY; The principal ID of the assigned identity. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + PrincipalID *string } // 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"` + DockerBridgeCidr *string - // 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"` + // Resource ID of a subnet for infrastructure components. Must not overlap with any other provided IP ranges. + InfrastructureSubnetID *string // 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"` + // resource. They must provide infrastructureSubnetId if enabling this property + Internal *bool // 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"` + PlatformReservedCidr *string // 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"` + PlatformReservedDNSIP *string } // Volume definitions for the Container App. type Volume struct { // Volume name. - Name *string `json:"name,omitempty"` + Name *string + + // List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. + Secrets []*SecretVolumeItem - // Name of storage resource. No need to provide for EmptyDir. - StorageName *string `json:"storageName,omitempty"` + // Name of storage resource. No need to provide for EmptyDir and Secret. + StorageName *string // Storage type for the volume. If not provided, use EmptyDir. - StorageType *StorageType `json:"storageType,omitempty"` + StorageType *StorageType } // 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"` + MountPath *string // This must match the Name of a Volume. - VolumeName *string `json:"volumeName,omitempty"` + VolumeName *string +} + +// WorkloadProfile - Workload profile to scope container app execution. +type WorkloadProfile struct { + // REQUIRED; Workload profile type for the workloads to run on. + Name *string + + // REQUIRED; Workload profile type for the workloads to run on. + WorkloadProfileType *string + + // The maximum capacity. + MaximumCount *int32 + + // The minimum capacity. + MinimumCount *int32 +} + +// WorkloadProfileStates - Collection of all the workload Profile States for a Managed Environment.. +type WorkloadProfileStates struct { + // Workload Profile resource specific properties. + Properties *WorkloadProfileStatesProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// WorkloadProfileStatesCollection - Collection of workloadProfileStates +type WorkloadProfileStatesCollection struct { + // REQUIRED; Collection of resources. + Value []*WorkloadProfileStates + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// WorkloadProfileStatesProperties - Workload Profile resource specific properties. +type WorkloadProfileStatesProperties struct { + // Current count of nodes. + CurrentCount *int32 + + // Maximum count of nodes. + MaximumCount *int32 + + // Minimum count of instances. + MinimumCount *int32 } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go b/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go index bb0bcc31f87a..95a59eb1c5d2 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go @@ -382,6 +382,127 @@ func (a *AvailableOperations) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AvailableWorkloadProfile. +func (a AvailableWorkloadProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableWorkloadProfile. +func (a *AvailableWorkloadProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableWorkloadProfileProperties. +func (a AvailableWorkloadProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicability", a.Applicability) + populate(objectMap, "category", a.Category) + populate(objectMap, "cores", a.Cores) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "memoryGiB", a.MemoryGiB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableWorkloadProfileProperties. +func (a *AvailableWorkloadProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicability": + err = unpopulate(val, "Applicability", &a.Applicability) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "cores": + err = unpopulate(val, "Cores", &a.Cores) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "memoryGiB": + err = unpopulate(val, "MemoryGiB", &a.MemoryGiB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableWorkloadProfilesCollection. +func (a AvailableWorkloadProfilesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableWorkloadProfilesCollection. +func (a *AvailableWorkloadProfilesCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AzureActiveDirectory. func (a AzureActiveDirectory) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -674,6 +795,166 @@ func (a *AzureStaticWebAppsRegistration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BaseContainer. +func (b BaseContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "args", b.Args) + populate(objectMap, "command", b.Command) + populate(objectMap, "env", b.Env) + populate(objectMap, "image", b.Image) + populate(objectMap, "name", b.Name) + populate(objectMap, "resources", b.Resources) + populate(objectMap, "volumeMounts", b.VolumeMounts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseContainer. +func (b *BaseContainer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "args": + err = unpopulate(val, "Args", &b.Args) + delete(rawMsg, key) + case "command": + err = unpopulate(val, "Command", &b.Command) + delete(rawMsg, key) + case "env": + err = unpopulate(val, "Env", &b.Env) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &b.Image) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &b.Resources) + delete(rawMsg, key) + case "volumeMounts": + err = unpopulate(val, "VolumeMounts", &b.VolumeMounts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingMeter. +func (b BillingMeter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingMeter. +func (b *BillingMeter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &b.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingMeterCollection. +func (b BillingMeterCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingMeterCollection. +func (b *BillingMeterCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingMeterProperties. +func (b BillingMeterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", b.Category) + populate(objectMap, "displayName", b.DisplayName) + populate(objectMap, "meterType", b.MeterType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingMeterProperties. +func (b *BillingMeterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &b.Category) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &b.DisplayName) + delete(rawMsg, key) + case "meterType": + err = unpopulate(val, "MeterType", &b.MeterType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Certificate. func (c Certificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -792,6 +1073,7 @@ func (c CertificateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "password", c.Password) populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "publicKeyHash", c.PublicKeyHash) + populate(objectMap, "subjectAlternativeNames", c.SubjectAlternativeNames) populate(objectMap, "subjectName", c.SubjectName) populate(objectMap, "thumbprint", c.Thumbprint) populate(objectMap, "valid", c.Valid) @@ -826,6 +1108,9 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { case "publicKeyHash": err = unpopulate(val, "PublicKeyHash", &c.PublicKeyHash) delete(rawMsg, key) + case "subjectAlternativeNames": + err = unpopulate(val, "SubjectAlternativeNames", &c.SubjectAlternativeNames) + delete(rawMsg, key) case "subjectName": err = unpopulate(val, "SubjectName", &c.SubjectName) delete(rawMsg, key) @@ -949,6 +1234,7 @@ func (c Configuration) MarshalJSON() ([]byte, error) { populate(objectMap, "activeRevisionsMode", c.ActiveRevisionsMode) populate(objectMap, "dapr", c.Dapr) populate(objectMap, "ingress", c.Ingress) + populate(objectMap, "maxInactiveRevisions", c.MaxInactiveRevisions) populate(objectMap, "registries", c.Registries) populate(objectMap, "secrets", c.Secrets) return json.Marshal(objectMap) @@ -972,6 +1258,9 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { case "ingress": err = unpopulate(val, "Ingress", &c.Ingress) delete(rawMsg, key) + case "maxInactiveRevisions": + err = unpopulate(val, "MaxInactiveRevisions", &c.MaxInactiveRevisions) + delete(rawMsg, key) case "registries": err = unpopulate(val, "Registries", &c.Registries) delete(rawMsg, key) @@ -986,22 +1275,22 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Container. -func (c Container) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironment. +func (c ConnectedEnvironment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "args", c.Args) - populate(objectMap, "command", c.Command) - populate(objectMap, "env", c.Env) - populate(objectMap, "image", c.Image) + populate(objectMap, "extendedLocation", c.ExtendedLocation) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) - populate(objectMap, "probes", c.Probes) - populate(objectMap, "resources", c.Resources) - populate(objectMap, "volumeMounts", c.VolumeMounts) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Container. -func (c *Container) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironment. +func (c *ConnectedEnvironment) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1009,29 +1298,29 @@ func (c *Container) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "args": - err = unpopulate(val, "Args", &c.Args) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &c.ExtendedLocation) delete(rawMsg, key) - case "command": - err = unpopulate(val, "Command", &c.Command) - delete(rawMsg, key) - case "env": - err = unpopulate(val, "Env", &c.Env) + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "image": - err = unpopulate(val, "Image", &c.Image) + case "location": + err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "probes": - err = unpopulate(val, "Probes", &c.Probes) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) - case "resources": - err = unpopulate(val, "Resources", &c.Resources) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) delete(rawMsg, key) - case "volumeMounts": - err = unpopulate(val, "VolumeMounts", &c.VolumeMounts) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { @@ -1041,22 +1330,16 @@ func (c *Container) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerApp. -func (c ContainerApp) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentCollection. +func (c ConnectedEnvironmentCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerApp. -func (c *ContainerApp) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentCollection. +func (c *ConnectedEnvironmentCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1064,29 +1347,11 @@ func (c *ContainerApp) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &c.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { @@ -1096,16 +1361,20 @@ func (c *ContainerApp) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerAppCollection. -func (c ContainerAppCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentProperties. +func (c ConnectedEnvironmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "customDomainConfiguration", c.CustomDomainConfiguration) + populate(objectMap, "daprAIConnectionString", c.DaprAIConnectionString) + populate(objectMap, "defaultDomain", c.DefaultDomain) + populate(objectMap, "deploymentErrors", c.DeploymentErrors) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "staticIp", c.StaticIP) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppCollection. -func (c *ContainerAppCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentProperties. +func (c *ConnectedEnvironmentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1113,11 +1382,23 @@ func (c *ContainerAppCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + case "customDomainConfiguration": + err = unpopulate(val, "CustomDomainConfiguration", &c.CustomDomainConfiguration) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "daprAIConnectionString": + err = unpopulate(val, "DaprAIConnectionString", &c.DaprAIConnectionString) + delete(rawMsg, key) + case "defaultDomain": + err = unpopulate(val, "DefaultDomain", &c.DefaultDomain) + delete(rawMsg, key) + case "deploymentErrors": + err = unpopulate(val, "DeploymentErrors", &c.DeploymentErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "staticIp": + err = unpopulate(val, "StaticIP", &c.StaticIP) delete(rawMsg, key) } if err != nil { @@ -1127,23 +1408,19 @@ func (c *ContainerAppCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerAppProbe. -func (c ContainerAppProbe) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentStorage. +func (c ConnectedEnvironmentStorage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "failureThreshold", c.FailureThreshold) - populate(objectMap, "httpGet", c.HTTPGet) - populate(objectMap, "initialDelaySeconds", c.InitialDelaySeconds) - populate(objectMap, "periodSeconds", c.PeriodSeconds) - populate(objectMap, "successThreshold", c.SuccessThreshold) - populate(objectMap, "tcpSocket", c.TCPSocket) - populate(objectMap, "terminationGracePeriodSeconds", c.TerminationGracePeriodSeconds) - populate(objectMap, "timeoutSeconds", c.TimeoutSeconds) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbe. -func (c *ContainerAppProbe) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentStorage. +func (c *ConnectedEnvironmentStorage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1151,29 +1428,17 @@ func (c *ContainerAppProbe) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "failureThreshold": - err = unpopulate(val, "FailureThreshold", &c.FailureThreshold) - delete(rawMsg, key) - case "httpGet": - err = unpopulate(val, "HTTPGet", &c.HTTPGet) - delete(rawMsg, key) - case "initialDelaySeconds": - err = unpopulate(val, "InitialDelaySeconds", &c.InitialDelaySeconds) - delete(rawMsg, key) - case "periodSeconds": - err = unpopulate(val, "PeriodSeconds", &c.PeriodSeconds) - delete(rawMsg, key) - case "successThreshold": - err = unpopulate(val, "SuccessThreshold", &c.SuccessThreshold) + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "tcpSocket": - err = unpopulate(val, "TCPSocket", &c.TCPSocket) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "terminationGracePeriodSeconds": - err = unpopulate(val, "TerminationGracePeriodSeconds", &c.TerminationGracePeriodSeconds) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) - case "timeoutSeconds": - err = unpopulate(val, "TimeoutSeconds", &c.TimeoutSeconds) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) @@ -1186,19 +1451,15 @@ func (c *ContainerAppProbe) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerAppProbeHTTPGet. -func (c ContainerAppProbeHTTPGet) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentStorageProperties. +func (c ConnectedEnvironmentStorageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "azureFile", c.AzureFile) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeHTTPGet. -func (c *ContainerAppProbeHTTPGet) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentStorageProperties. +func (c *ConnectedEnvironmentStorageProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1206,20 +1467,8 @@ func (c *ContainerAppProbeHTTPGet) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "httpHeaders": - err = unpopulate(val, "HTTPHeaders", &c.HTTPHeaders) - delete(rawMsg, key) - case "host": - err = unpopulate(val, "Host", &c.Host) - delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &c.Path) - delete(rawMsg, key) - case "port": - err = unpopulate(val, "Port", &c.Port) - delete(rawMsg, key) - case "scheme": - err = unpopulate(val, "Scheme", &c.Scheme) + case "azureFile": + err = unpopulate(val, "AzureFile", &c.AzureFile) delete(rawMsg, key) } if err != nil { @@ -1229,16 +1478,15 @@ func (c *ContainerAppProbeHTTPGet) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerAppProbeHTTPGetHTTPHeadersItem. -func (c ContainerAppProbeHTTPGetHTTPHeadersItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentStoragesCollection. +func (c ConnectedEnvironmentStoragesCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", c.Name) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeHTTPGetHTTPHeadersItem. -func (c *ContainerAppProbeHTTPGetHTTPHeadersItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentStoragesCollection. +func (c *ConnectedEnvironmentStoragesCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1246,9 +1494,6 @@ func (c *ContainerAppProbeHTTPGetHTTPHeadersItem) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) @@ -1260,16 +1505,22 @@ func (c *ContainerAppProbeHTTPGetHTTPHeadersItem) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerAppProbeTCPSocket. -func (c ContainerAppProbeTCPSocket) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Container. +func (c Container) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "host", c.Host) - populate(objectMap, "port", c.Port) + populate(objectMap, "args", c.Args) + populate(objectMap, "command", c.Command) + populate(objectMap, "env", c.Env) + populate(objectMap, "image", c.Image) + populate(objectMap, "name", c.Name) + populate(objectMap, "probes", c.Probes) + populate(objectMap, "resources", c.Resources) + populate(objectMap, "volumeMounts", c.VolumeMounts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeTCPSocket. -func (c *ContainerAppProbeTCPSocket) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Container. +func (c *Container) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1277,11 +1528,29 @@ func (c *ContainerAppProbeTCPSocket) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "host": - err = unpopulate(val, "Host", &c.Host) + case "args": + err = unpopulate(val, "Args", &c.Args) delete(rawMsg, key) - case "port": - err = unpopulate(val, "Port", &c.Port) + case "command": + err = unpopulate(val, "Command", &c.Command) + delete(rawMsg, key) + case "env": + err = unpopulate(val, "Env", &c.Env) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &c.Image) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "probes": + err = unpopulate(val, "Probes", &c.Probes) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &c.Resources) + delete(rawMsg, key) + case "volumeMounts": + err = unpopulate(val, "VolumeMounts", &c.VolumeMounts) delete(rawMsg, key) } if err != nil { @@ -1291,22 +1560,24 @@ func (c *ContainerAppProbeTCPSocket) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerAppProperties. -func (c ContainerAppProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerApp. +func (c ContainerApp) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "extendedLocation", c.ExtendedLocation) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "managedBy", c.ManagedBy) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProperties. -func (c *ContainerAppProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerApp. +func (c *ContainerApp) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1314,29 +1585,35 @@ func (c *ContainerAppProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "configuration": - err = unpopulate(val, "Configuration", &c.Configuration) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &c.ExtendedLocation) delete(rawMsg, key) - case "customDomainVerificationId": - err = unpopulate(val, "CustomDomainVerificationID", &c.CustomDomainVerificationID) + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "latestRevisionFqdn": - err = unpopulate(val, "LatestRevisionFqdn", &c.LatestRevisionFqdn) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) delete(rawMsg, key) - case "latestRevisionName": - err = unpopulate(val, "LatestRevisionName", &c.LatestRevisionName) + case "location": + err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) - case "managedEnvironmentId": - err = unpopulate(val, "ManagedEnvironmentID", &c.ManagedEnvironmentID) + case "managedBy": + err = unpopulate(val, "ManagedBy", &c.ManagedBy) delete(rawMsg, key) - case "outboundIPAddresses": - err = unpopulate(val, "OutboundIPAddresses", &c.OutboundIPAddresses) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) - case "template": - err = unpopulate(val, "Template", &c.Template) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { @@ -1346,16 +1623,21 @@ func (c *ContainerAppProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerAppSecret. -func (c ContainerAppSecret) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppAuthToken. +func (c ContainerAppAuthToken) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) - populate(objectMap, "value", c.Value) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppSecret. -func (c *ContainerAppSecret) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppAuthToken. +func (c *ContainerAppAuthToken) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1363,11 +1645,26 @@ func (c *ContainerAppSecret) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { @@ -1377,17 +1674,16 @@ func (c *ContainerAppSecret) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerResources. -func (c ContainerResources) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppAuthTokenProperties. +func (c ContainerAppAuthTokenProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cpu", c.CPU) - populate(objectMap, "ephemeralStorage", c.EphemeralStorage) - populate(objectMap, "memory", c.Memory) + populateTimeRFC3339(objectMap, "expires", c.Expires) + populate(objectMap, "token", c.Token) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerResources. -func (c *ContainerResources) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppAuthTokenProperties. +func (c *ContainerAppAuthTokenProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1395,14 +1691,11 @@ func (c *ContainerResources) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "cpu": - err = unpopulate(val, "CPU", &c.CPU) - delete(rawMsg, key) - case "ephemeralStorage": - err = unpopulate(val, "EphemeralStorage", &c.EphemeralStorage) + case "expires": + err = unpopulateTimeRFC3339(val, "Expires", &c.Expires) delete(rawMsg, key) - case "memory": - err = unpopulate(val, "Memory", &c.Memory) + case "token": + err = unpopulate(val, "Token", &c.Token) delete(rawMsg, key) } if err != nil { @@ -1412,16 +1705,16 @@ func (c *ContainerResources) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CookieExpiration. -func (c CookieExpiration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppCollection. +func (c ContainerAppCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "convention", c.Convention) - populate(objectMap, "timeToExpiration", c.TimeToExpiration) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CookieExpiration. -func (c *CookieExpiration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppCollection. +func (c *ContainerAppCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1429,11 +1722,11 @@ func (c *CookieExpiration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "convention": - err = unpopulate(val, "Convention", &c.Convention) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "timeToExpiration": - err = unpopulate(val, "TimeToExpiration", &c.TimeToExpiration) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { @@ -1443,17 +1736,16 @@ func (c *CookieExpiration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomDomain. -func (c CustomDomain) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppJobExecutions. +func (c ContainerAppJobExecutions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "bindingType", c.BindingType) - populate(objectMap, "certificateId", c.CertificateID) - populate(objectMap, "name", c.Name) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDomain. -func (c *CustomDomain) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppJobExecutions. +func (c *ContainerAppJobExecutions) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1461,14 +1753,11 @@ func (c *CustomDomain) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "bindingType": - err = unpopulate(val, "BindingType", &c.BindingType) - delete(rawMsg, key) - case "certificateId": - err = unpopulate(val, "CertificateID", &c.CertificateID) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { @@ -1478,19 +1767,23 @@ func (c *CustomDomain) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomHostnameAnalysisResult. -func (c CustomHostnameAnalysisResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppProbe. +func (c ContainerAppProbe) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "failureThreshold", c.FailureThreshold) + populate(objectMap, "httpGet", c.HTTPGet) + populate(objectMap, "initialDelaySeconds", c.InitialDelaySeconds) + populate(objectMap, "periodSeconds", c.PeriodSeconds) + populate(objectMap, "successThreshold", c.SuccessThreshold) + populate(objectMap, "tcpSocket", c.TCPSocket) + populate(objectMap, "terminationGracePeriodSeconds", c.TerminationGracePeriodSeconds) + populate(objectMap, "timeoutSeconds", c.TimeoutSeconds) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHostnameAnalysisResult. -func (c *CustomHostnameAnalysisResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbe. +func (c *ContainerAppProbe) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1498,17 +1791,29 @@ func (c *CustomHostnameAnalysisResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) + case "failureThreshold": + err = unpopulate(val, "FailureThreshold", &c.FailureThreshold) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + case "httpGet": + err = unpopulate(val, "HTTPGet", &c.HTTPGet) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "initialDelaySeconds": + err = unpopulate(val, "InitialDelaySeconds", &c.InitialDelaySeconds) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) + case "periodSeconds": + err = unpopulate(val, "PeriodSeconds", &c.PeriodSeconds) + delete(rawMsg, key) + case "successThreshold": + err = unpopulate(val, "SuccessThreshold", &c.SuccessThreshold) + delete(rawMsg, key) + case "tcpSocket": + err = unpopulate(val, "TCPSocket", &c.TCPSocket) + delete(rawMsg, key) + case "terminationGracePeriodSeconds": + err = unpopulate(val, "TerminationGracePeriodSeconds", &c.TerminationGracePeriodSeconds) + delete(rawMsg, key) + case "timeoutSeconds": + err = unpopulate(val, "TimeoutSeconds", &c.TimeoutSeconds) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) @@ -1521,25 +1826,19 @@ func (c *CustomHostnameAnalysisResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomHostnameAnalysisResultProperties. -func (c CustomHostnameAnalysisResultProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppProbeHTTPGet. +func (c ContainerAppProbeHTTPGet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "httpHeaders", c.HTTPHeaders) + populate(objectMap, "host", c.Host) + populate(objectMap, "path", c.Path) + populate(objectMap, "port", c.Port) + populate(objectMap, "scheme", c.Scheme) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHostnameAnalysisResultProperties. -func (c *CustomHostnameAnalysisResultProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeHTTPGet. +func (c *ContainerAppProbeHTTPGet) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1547,38 +1846,20 @@ func (c *CustomHostnameAnalysisResultProperties) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "aRecords": - err = unpopulate(val, "ARecords", &c.ARecords) - delete(rawMsg, key) - case "alternateCNameRecords": - err = unpopulate(val, "AlternateCNameRecords", &c.AlternateCNameRecords) - delete(rawMsg, key) - case "alternateTxtRecords": - err = unpopulate(val, "AlternateTxtRecords", &c.AlternateTxtRecords) - delete(rawMsg, key) - case "cNameRecords": - err = unpopulate(val, "CNameRecords", &c.CNameRecords) - delete(rawMsg, key) - case "conflictingContainerAppResourceId": - err = unpopulate(val, "ConflictingContainerAppResourceID", &c.ConflictingContainerAppResourceID) - delete(rawMsg, key) - case "customDomainVerificationFailureInfo": - err = unpopulate(val, "CustomDomainVerificationFailureInfo", &c.CustomDomainVerificationFailureInfo) - delete(rawMsg, key) - case "customDomainVerificationTest": - err = unpopulate(val, "CustomDomainVerificationTest", &c.CustomDomainVerificationTest) + case "httpHeaders": + err = unpopulate(val, "HTTPHeaders", &c.HTTPHeaders) delete(rawMsg, key) - case "hasConflictOnManagedEnvironment": - err = unpopulate(val, "HasConflictOnManagedEnvironment", &c.HasConflictOnManagedEnvironment) + case "host": + err = unpopulate(val, "Host", &c.Host) delete(rawMsg, key) - case "hostName": - err = unpopulate(val, "HostName", &c.HostName) + case "path": + err = unpopulate(val, "Path", &c.Path) delete(rawMsg, key) - case "isHostnameAlreadyVerified": - err = unpopulate(val, "IsHostnameAlreadyVerified", &c.IsHostnameAlreadyVerified) + case "port": + err = unpopulate(val, "Port", &c.Port) delete(rawMsg, key) - case "txtRecords": - err = unpopulate(val, "TxtRecords", &c.TxtRecords) + case "scheme": + err = unpopulate(val, "Scheme", &c.Scheme) delete(rawMsg, key) } if err != nil { @@ -1588,17 +1869,16 @@ func (c *CustomHostnameAnalysisResultProperties) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomOpenIDConnectProvider. -func (c CustomOpenIDConnectProvider) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppProbeHTTPGetHTTPHeadersItem. +func (c ContainerAppProbeHTTPGetHTTPHeadersItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", c.Enabled) - populate(objectMap, "login", c.Login) - populate(objectMap, "registration", c.Registration) + populate(objectMap, "name", c.Name) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomOpenIDConnectProvider. -func (c *CustomOpenIDConnectProvider) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeHTTPGetHTTPHeadersItem. +func (c *ContainerAppProbeHTTPGetHTTPHeadersItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1606,14 +1886,11 @@ func (c *CustomOpenIDConnectProvider) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &c.Enabled) - delete(rawMsg, key) - case "login": - err = unpopulate(val, "Login", &c.Login) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "registration": - err = unpopulate(val, "Registration", &c.Registration) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { @@ -1623,17 +1900,16 @@ func (c *CustomOpenIDConnectProvider) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomScaleRule. -func (c CustomScaleRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppProbeTCPSocket. +func (c ContainerAppProbeTCPSocket) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "auth", c.Auth) - populate(objectMap, "metadata", c.Metadata) - populate(objectMap, "type", c.Type) + populate(objectMap, "host", c.Host) + populate(objectMap, "port", c.Port) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomScaleRule. -func (c *CustomScaleRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProbeTCPSocket. +func (c *ContainerAppProbeTCPSocket) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1641,14 +1917,11 @@ func (c *CustomScaleRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "auth": - err = unpopulate(val, "Auth", &c.Auth) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &c.Metadata) + case "host": + err = unpopulate(val, "Host", &c.Host) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "port": + err = unpopulate(val, "Port", &c.Port) delete(rawMsg, key) } if err != nil { @@ -1658,994 +1931,3143 @@ func (c *CustomScaleRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Dapr. -func (d Dapr) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerAppProperties. +func (c ContainerAppProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "appId", d.AppID) - populate(objectMap, "appPort", d.AppPort) - populate(objectMap, "appProtocol", d.AppProtocol) - populate(objectMap, "enabled", d.Enabled) + populate(objectMap, "configuration", c.Configuration) + populate(objectMap, "customDomainVerificationId", c.CustomDomainVerificationID) + populate(objectMap, "environmentId", c.EnvironmentID) + populate(objectMap, "eventStreamEndpoint", c.EventStreamEndpoint) + populate(objectMap, "latestReadyRevisionName", c.LatestReadyRevisionName) + populate(objectMap, "latestRevisionFqdn", c.LatestRevisionFqdn) + populate(objectMap, "latestRevisionName", c.LatestRevisionName) + populate(objectMap, "managedEnvironmentId", c.ManagedEnvironmentID) + populate(objectMap, "outboundIpAddresses", c.OutboundIPAddresses) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "template", c.Template) + populate(objectMap, "workloadProfileName", c.WorkloadProfileName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Dapr. -func (d *Dapr) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppProperties. +func (c *ContainerAppProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "appId": - err = unpopulate(val, "AppID", &d.AppID) + case "configuration": + err = unpopulate(val, "Configuration", &c.Configuration) delete(rawMsg, key) - case "appPort": - err = unpopulate(val, "AppPort", &d.AppPort) + case "customDomainVerificationId": + err = unpopulate(val, "CustomDomainVerificationID", &c.CustomDomainVerificationID) delete(rawMsg, key) - case "appProtocol": - err = unpopulate(val, "AppProtocol", &d.AppProtocol) + case "environmentId": + err = unpopulate(val, "EnvironmentID", &c.EnvironmentID) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) + case "eventStreamEndpoint": + err = unpopulate(val, "EventStreamEndpoint", &c.EventStreamEndpoint) + delete(rawMsg, key) + case "latestReadyRevisionName": + err = unpopulate(val, "LatestReadyRevisionName", &c.LatestReadyRevisionName) + delete(rawMsg, key) + case "latestRevisionFqdn": + err = unpopulate(val, "LatestRevisionFqdn", &c.LatestRevisionFqdn) + delete(rawMsg, key) + case "latestRevisionName": + err = unpopulate(val, "LatestRevisionName", &c.LatestRevisionName) + delete(rawMsg, key) + case "managedEnvironmentId": + err = unpopulate(val, "ManagedEnvironmentID", &c.ManagedEnvironmentID) + delete(rawMsg, key) + case "outboundIpAddresses": + err = unpopulate(val, "OutboundIPAddresses", &c.OutboundIPAddresses) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &c.Template) + delete(rawMsg, key) + case "workloadProfileName": + err = unpopulate(val, "WorkloadProfileName", &c.WorkloadProfileName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DaprComponent. +// MarshalJSON implements the json.Marshaller interface for type ContainerAppSecret. +func (c ContainerAppSecret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "keyVaultUrl", c.KeyVaultURL) + populate(objectMap, "name", c.Name) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppSecret. +func (c *ContainerAppSecret) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "keyVaultUrl": + err = unpopulate(val, "KeyVaultURL", &c.KeyVaultURL) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerResources. +func (c ContainerResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cpu", c.CPU) + populate(objectMap, "ephemeralStorage", c.EphemeralStorage) + populate(objectMap, "memory", c.Memory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerResources. +func (c *ContainerResources) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cpu": + err = unpopulate(val, "CPU", &c.CPU) + delete(rawMsg, key) + case "ephemeralStorage": + err = unpopulate(val, "EphemeralStorage", &c.EphemeralStorage) + delete(rawMsg, key) + case "memory": + err = unpopulate(val, "Memory", &c.Memory) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CookieExpiration. +func (c CookieExpiration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "convention", c.Convention) + populate(objectMap, "timeToExpiration", c.TimeToExpiration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CookieExpiration. +func (c *CookieExpiration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "convention": + err = unpopulate(val, "Convention", &c.Convention) + delete(rawMsg, key) + case "timeToExpiration": + err = unpopulate(val, "TimeToExpiration", &c.TimeToExpiration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CorsPolicy. +func (c CorsPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowCredentials", c.AllowCredentials) + populate(objectMap, "allowedHeaders", c.AllowedHeaders) + populate(objectMap, "allowedMethods", c.AllowedMethods) + populate(objectMap, "allowedOrigins", c.AllowedOrigins) + populate(objectMap, "exposeHeaders", c.ExposeHeaders) + populate(objectMap, "maxAge", c.MaxAge) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CorsPolicy. +func (c *CorsPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowCredentials": + err = unpopulate(val, "AllowCredentials", &c.AllowCredentials) + delete(rawMsg, key) + case "allowedHeaders": + err = unpopulate(val, "AllowedHeaders", &c.AllowedHeaders) + delete(rawMsg, key) + case "allowedMethods": + err = unpopulate(val, "AllowedMethods", &c.AllowedMethods) + delete(rawMsg, key) + case "allowedOrigins": + err = unpopulate(val, "AllowedOrigins", &c.AllowedOrigins) + delete(rawMsg, key) + case "exposeHeaders": + err = unpopulate(val, "ExposeHeaders", &c.ExposeHeaders) + delete(rawMsg, key) + case "maxAge": + err = unpopulate(val, "MaxAge", &c.MaxAge) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomDomain. +func (c CustomDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bindingType", c.BindingType) + populate(objectMap, "certificateId", c.CertificateID) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDomain. +func (c *CustomDomain) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bindingType": + err = unpopulate(val, "BindingType", &c.BindingType) + delete(rawMsg, key) + case "certificateId": + err = unpopulate(val, "CertificateID", &c.CertificateID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomDomainConfiguration. +func (c CustomDomainConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificatePassword", c.CertificatePassword) + populateByteArray(objectMap, "certificateValue", c.CertificateValue, runtime.Base64StdFormat) + populate(objectMap, "customDomainVerificationId", c.CustomDomainVerificationID) + populate(objectMap, "dnsSuffix", c.DNSSuffix) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) + populate(objectMap, "subjectName", c.SubjectName) + populate(objectMap, "thumbprint", c.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDomainConfiguration. +func (c *CustomDomainConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificatePassword": + err = unpopulate(val, "CertificatePassword", &c.CertificatePassword) + delete(rawMsg, key) + case "certificateValue": + err = runtime.DecodeByteArray(string(val), &c.CertificateValue, runtime.Base64StdFormat) + delete(rawMsg, key) + case "customDomainVerificationId": + err = unpopulate(val, "CustomDomainVerificationID", &c.CustomDomainVerificationID) + delete(rawMsg, key) + case "dnsSuffix": + err = unpopulate(val, "DNSSuffix", &c.DNSSuffix) + delete(rawMsg, key) + case "expirationDate": + err = unpopulateTimeRFC3339(val, "ExpirationDate", &c.ExpirationDate) + delete(rawMsg, key) + case "subjectName": + err = unpopulate(val, "SubjectName", &c.SubjectName) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomHostnameAnalysisResult. +func (c CustomHostnameAnalysisResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aRecords", c.ARecords) + populate(objectMap, "alternateCNameRecords", c.AlternateCNameRecords) + populate(objectMap, "alternateTxtRecords", c.AlternateTxtRecords) + populate(objectMap, "cNameRecords", c.CNameRecords) + populate(objectMap, "conflictWithEnvironmentCustomDomain", c.ConflictWithEnvironmentCustomDomain) + populate(objectMap, "conflictingContainerAppResourceId", c.ConflictingContainerAppResourceID) + populate(objectMap, "customDomainVerificationFailureInfo", c.CustomDomainVerificationFailureInfo) + populate(objectMap, "customDomainVerificationTest", c.CustomDomainVerificationTest) + populate(objectMap, "hasConflictOnManagedEnvironment", c.HasConflictOnManagedEnvironment) + populate(objectMap, "hostName", c.HostName) + populate(objectMap, "isHostnameAlreadyVerified", c.IsHostnameAlreadyVerified) + populate(objectMap, "txtRecords", c.TxtRecords) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHostnameAnalysisResult. +func (c *CustomHostnameAnalysisResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aRecords": + err = unpopulate(val, "ARecords", &c.ARecords) + delete(rawMsg, key) + case "alternateCNameRecords": + err = unpopulate(val, "AlternateCNameRecords", &c.AlternateCNameRecords) + delete(rawMsg, key) + case "alternateTxtRecords": + err = unpopulate(val, "AlternateTxtRecords", &c.AlternateTxtRecords) + delete(rawMsg, key) + case "cNameRecords": + err = unpopulate(val, "CNameRecords", &c.CNameRecords) + delete(rawMsg, key) + case "conflictWithEnvironmentCustomDomain": + err = unpopulate(val, "ConflictWithEnvironmentCustomDomain", &c.ConflictWithEnvironmentCustomDomain) + delete(rawMsg, key) + case "conflictingContainerAppResourceId": + err = unpopulate(val, "ConflictingContainerAppResourceID", &c.ConflictingContainerAppResourceID) + delete(rawMsg, key) + case "customDomainVerificationFailureInfo": + err = unpopulate(val, "CustomDomainVerificationFailureInfo", &c.CustomDomainVerificationFailureInfo) + delete(rawMsg, key) + case "customDomainVerificationTest": + err = unpopulate(val, "CustomDomainVerificationTest", &c.CustomDomainVerificationTest) + delete(rawMsg, key) + case "hasConflictOnManagedEnvironment": + err = unpopulate(val, "HasConflictOnManagedEnvironment", &c.HasConflictOnManagedEnvironment) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &c.HostName) + delete(rawMsg, key) + case "isHostnameAlreadyVerified": + err = unpopulate(val, "IsHostnameAlreadyVerified", &c.IsHostnameAlreadyVerified) + delete(rawMsg, key) + case "txtRecords": + err = unpopulate(val, "TxtRecords", &c.TxtRecords) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo. +func (c CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", c.Code) + populate(objectMap, "details", c.Details) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo. +func (c *CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &c.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem. +func (c CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", c.Code) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem. +func (c *CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomOpenIDConnectProvider. +func (c CustomOpenIDConnectProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", c.Enabled) + populate(objectMap, "login", c.Login) + populate(objectMap, "registration", c.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomOpenIDConnectProvider. +func (c *CustomOpenIDConnectProvider) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &c.Enabled) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &c.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &c.Registration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomScaleRule. +func (c CustomScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "auth", c.Auth) + populate(objectMap, "metadata", c.Metadata) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomScaleRule. +func (c *CustomScaleRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auth": + err = unpopulate(val, "Auth", &c.Auth) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &c.Metadata) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dapr. +func (d Dapr) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appId", d.AppID) + populate(objectMap, "appPort", d.AppPort) + populate(objectMap, "appProtocol", d.AppProtocol) + populate(objectMap, "enableApiLogging", d.EnableAPILogging) + populate(objectMap, "enabled", d.Enabled) + populate(objectMap, "httpMaxRequestSize", d.HTTPMaxRequestSize) + populate(objectMap, "httpReadBufferSize", d.HTTPReadBufferSize) + populate(objectMap, "logLevel", d.LogLevel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dapr. +func (d *Dapr) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appId": + err = unpopulate(val, "AppID", &d.AppID) + delete(rawMsg, key) + case "appPort": + err = unpopulate(val, "AppPort", &d.AppPort) + delete(rawMsg, key) + case "appProtocol": + err = unpopulate(val, "AppProtocol", &d.AppProtocol) + delete(rawMsg, key) + case "enableApiLogging": + err = unpopulate(val, "EnableAPILogging", &d.EnableAPILogging) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + delete(rawMsg, key) + case "httpMaxRequestSize": + err = unpopulate(val, "HTTPMaxRequestSize", &d.HTTPMaxRequestSize) + delete(rawMsg, key) + case "httpReadBufferSize": + err = unpopulate(val, "HTTPReadBufferSize", &d.HTTPReadBufferSize) + delete(rawMsg, key) + case "logLevel": + err = unpopulate(val, "LogLevel", &d.LogLevel) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponent. func (d DaprComponent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponent. +func (d *DaprComponent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentProperties. +func (d DaprComponentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "componentType", d.ComponentType) + populate(objectMap, "ignoreErrors", d.IgnoreErrors) + populate(objectMap, "initTimeout", d.InitTimeout) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "scopes", d.Scopes) + populate(objectMap, "secretStoreComponent", d.SecretStoreComponent) + populate(objectMap, "secrets", d.Secrets) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentProperties. +func (d *DaprComponentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "componentType": + err = unpopulate(val, "ComponentType", &d.ComponentType) + delete(rawMsg, key) + case "ignoreErrors": + err = unpopulate(val, "IgnoreErrors", &d.IgnoreErrors) + delete(rawMsg, key) + case "initTimeout": + err = unpopulate(val, "InitTimeout", &d.InitTimeout) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &d.Scopes) + delete(rawMsg, key) + case "secretStoreComponent": + err = unpopulate(val, "SecretStoreComponent", &d.SecretStoreComponent) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &d.Secrets) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentsCollection. +func (d DaprComponentsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentsCollection. +func (d *DaprComponentsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprConfiguration. +func (d DaprConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprConfiguration. +func (d *DaprConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprMetadata. +func (d DaprMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + populate(objectMap, "secretRef", d.SecretRef) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprMetadata. +func (d *DaprMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "secretRef": + err = unpopulate(val, "SecretRef", &d.SecretRef) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprSecret. +func (d DaprSecret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSecret. +func (d *DaprSecret) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprSecretsCollection. +func (d DaprSecretsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSecretsCollection. +func (d *DaprSecretsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DefaultAuthorizationPolicy. +func (d DefaultAuthorizationPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedApplications", d.AllowedApplications) + populate(objectMap, "allowedPrincipals", d.AllowedPrincipals) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultAuthorizationPolicy. +func (d *DefaultAuthorizationPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedApplications": + err = unpopulate(val, "AllowedApplications", &d.AllowedApplications) + delete(rawMsg, key) + case "allowedPrincipals": + err = unpopulate(val, "AllowedPrincipals", &d.AllowedPrincipals) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponse. +func (d DefaultErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", d.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponse. +func (d *DefaultErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &d.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponseError. +func (d DefaultErrorResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", d.Code) + populate(objectMap, "details", d.Details) + populate(objectMap, "innererror", d.Innererror) + populate(objectMap, "message", d.Message) + populate(objectMap, "target", d.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponseError. +func (d *DefaultErrorResponseError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &d.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &d.Details) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &d.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponseErrorDetailsItem. +func (d DefaultErrorResponseErrorDetailsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", d.Code) + populate(objectMap, "message", d.Message) + populate(objectMap, "target", d.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponseErrorDetailsItem. +func (d *DefaultErrorResponseErrorDetailsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &d.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticDataProviderMetadata. +func (d DiagnosticDataProviderMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "propertyBag", d.PropertyBag) + populate(objectMap, "providerName", d.ProviderName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDataProviderMetadata. +func (d *DiagnosticDataProviderMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "propertyBag": + err = unpopulate(val, "PropertyBag", &d.PropertyBag) + delete(rawMsg, key) + case "providerName": + err = unpopulate(val, "ProviderName", &d.ProviderName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticDataProviderMetadataPropertyBagItem. +func (d DiagnosticDataProviderMetadataPropertyBagItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDataProviderMetadataPropertyBagItem. +func (d *DiagnosticDataProviderMetadataPropertyBagItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticDataTableResponseColumn. +func (d DiagnosticDataTableResponseColumn) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columnName", d.ColumnName) + populate(objectMap, "columnType", d.ColumnType) + populate(objectMap, "dataType", d.DataType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDataTableResponseColumn. +func (d *DiagnosticDataTableResponseColumn) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columnName": + err = unpopulate(val, "ColumnName", &d.ColumnName) + delete(rawMsg, key) + case "columnType": + err = unpopulate(val, "ColumnType", &d.ColumnType) + delete(rawMsg, key) + case "dataType": + err = unpopulate(val, "DataType", &d.DataType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticDataTableResponseObject. +func (d DiagnosticDataTableResponseObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columns", d.Columns) + populate(objectMap, "rows", d.Rows) + populate(objectMap, "tableName", d.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDataTableResponseObject. +func (d *DiagnosticDataTableResponseObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &d.Columns) + delete(rawMsg, key) + case "rows": + err = unpopulate(val, "Rows", &d.Rows) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &d.TableName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticRendering. +func (d DiagnosticRendering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", d.Description) + populate(objectMap, "isVisible", d.IsVisible) + populate(objectMap, "title", d.Title) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticRendering. +func (d *DiagnosticRendering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "isVisible": + err = unpopulate(val, "IsVisible", &d.IsVisible) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &d.Title) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticSupportTopic. +func (d DiagnosticSupportTopic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "pesId", d.PesID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSupportTopic. +func (d *DiagnosticSupportTopic) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "pesId": + err = unpopulate(val, "PesID", &d.PesID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Diagnostics. +func (d Diagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Diagnostics. +func (d *Diagnostics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticsCollection. +func (d DiagnosticsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsCollection. +func (d *DiagnosticsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticsDataAPIResponse. +func (d DiagnosticsDataAPIResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "renderingProperties", d.RenderingProperties) + populate(objectMap, "table", d.Table) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsDataAPIResponse. +func (d *DiagnosticsDataAPIResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "renderingProperties": + err = unpopulate(val, "RenderingProperties", &d.RenderingProperties) + delete(rawMsg, key) + case "table": + err = unpopulate(val, "Table", &d.Table) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticsDefinition. +func (d DiagnosticsDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "analysisTypes", d.AnalysisTypes) + populate(objectMap, "author", d.Author) + populate(objectMap, "category", d.Category) + populate(objectMap, "description", d.Description) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "score", d.Score) + populate(objectMap, "supportTopicList", d.SupportTopicList) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsDefinition. +func (d *DiagnosticsDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "analysisTypes": + err = unpopulate(val, "AnalysisTypes", &d.AnalysisTypes) + delete(rawMsg, key) + case "author": + err = unpopulate(val, "Author", &d.Author) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &d.Category) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "score": + err = unpopulate(val, "Score", &d.Score) + delete(rawMsg, key) + case "supportTopicList": + err = unpopulate(val, "SupportTopicList", &d.SupportTopicList) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticsProperties. +func (d DiagnosticsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataProviderMetadata", d.DataProviderMetadata) + populate(objectMap, "dataset", d.Dataset) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "status", d.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsProperties. +func (d *DiagnosticsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataProviderMetadata": + err = unpopulate(val, "DataProviderMetadata", &d.DataProviderMetadata) + delete(rawMsg, key) + case "dataset": + err = unpopulate(val, "Dataset", &d.Dataset) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticsStatus. +func (d DiagnosticsStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", d.Message) + populate(objectMap, "statusId", d.StatusID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsStatus. +func (d *DiagnosticsStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "statusId": + err = unpopulate(val, "StatusID", &d.StatusID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnvironmentAuthToken. +func (e EnvironmentAuthToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentAuthToken. +func (e *EnvironmentAuthToken) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnvironmentAuthTokenProperties. +func (e EnvironmentAuthTokenProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "expires", e.Expires) + populate(objectMap, "token", e.Token) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentAuthTokenProperties. +func (e *EnvironmentAuthTokenProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expires": + err = unpopulateTimeRFC3339(val, "Expires", &e.Expires) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &e.Token) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnvironmentVar. +func (e EnvironmentVar) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + populate(objectMap, "secretRef", e.SecretRef) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentVar. +func (e *EnvironmentVar) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "secretRef": + err = unpopulate(val, "SecretRef", &e.SecretRef) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Facebook. +func (f Facebook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", f.Enabled) + populate(objectMap, "graphApiVersion", f.GraphAPIVersion) + populate(objectMap, "login", f.Login) + populate(objectMap, "registration", f.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Facebook. +func (f *Facebook) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &f.Enabled) + delete(rawMsg, key) + case "graphApiVersion": + err = unpopulate(val, "GraphAPIVersion", &f.GraphAPIVersion) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &f.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &f.Registration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForwardProxy. +func (f ForwardProxy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "convention", f.Convention) + populate(objectMap, "customHostHeaderName", f.CustomHostHeaderName) + populate(objectMap, "customProtoHeaderName", f.CustomProtoHeaderName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForwardProxy. +func (f *ForwardProxy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "convention": + err = unpopulate(val, "Convention", &f.Convention) + delete(rawMsg, key) + case "customHostHeaderName": + err = unpopulate(val, "CustomHostHeaderName", &f.CustomHostHeaderName) + delete(rawMsg, key) + case "customProtoHeaderName": + err = unpopulate(val, "CustomProtoHeaderName", &f.CustomProtoHeaderName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GitHub. +func (g GitHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", g.Enabled) + populate(objectMap, "login", g.Login) + populate(objectMap, "registration", g.Registration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GitHub. +func (g *GitHub) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &g.Enabled) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &g.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &g.Registration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GithubActionConfiguration. +func (g GithubActionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureCredentials", g.AzureCredentials) + populate(objectMap, "contextPath", g.ContextPath) + populate(objectMap, "image", g.Image) + populate(objectMap, "os", g.OS) + populate(objectMap, "publishType", g.PublishType) + populate(objectMap, "registryInfo", g.RegistryInfo) + populate(objectMap, "runtimeStack", g.RuntimeStack) + populate(objectMap, "runtimeVersion", g.RuntimeVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GithubActionConfiguration. +func (g *GithubActionConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureCredentials": + err = unpopulate(val, "AzureCredentials", &g.AzureCredentials) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &g.ContextPath) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &g.Image) + delete(rawMsg, key) + case "os": + err = unpopulate(val, "OS", &g.OS) + delete(rawMsg, key) + case "publishType": + err = unpopulate(val, "PublishType", &g.PublishType) + delete(rawMsg, key) + case "registryInfo": + err = unpopulate(val, "RegistryInfo", &g.RegistryInfo) + delete(rawMsg, key) + case "runtimeStack": + err = unpopulate(val, "RuntimeStack", &g.RuntimeStack) + delete(rawMsg, key) + case "runtimeVersion": + err = unpopulate(val, "RuntimeVersion", &g.RuntimeVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GlobalValidation. +func (g GlobalValidation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "excludedPaths", g.ExcludedPaths) + populate(objectMap, "redirectToProvider", g.RedirectToProvider) + populate(objectMap, "unauthenticatedClientAction", g.UnauthenticatedClientAction) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalValidation. +func (g *GlobalValidation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "excludedPaths": + err = unpopulate(val, "ExcludedPaths", &g.ExcludedPaths) + delete(rawMsg, key) + case "redirectToProvider": + err = unpopulate(val, "RedirectToProvider", &g.RedirectToProvider) + delete(rawMsg, key) + case "unauthenticatedClientAction": + err = unpopulate(val, "UnauthenticatedClientAction", &g.UnauthenticatedClientAction) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Google. +func (g Google) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", g.Enabled) + populate(objectMap, "login", g.Login) + populate(objectMap, "registration", g.Registration) + populate(objectMap, "validation", g.Validation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Google. +func (g *Google) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &g.Enabled) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &g.Login) + delete(rawMsg, key) + case "registration": + err = unpopulate(val, "Registration", &g.Registration) + delete(rawMsg, key) + case "validation": + err = unpopulate(val, "Validation", &g.Validation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPScaleRule. +func (h HTTPScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "auth", h.Auth) + populate(objectMap, "metadata", h.Metadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPScaleRule. +func (h *HTTPScaleRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auth": + err = unpopulate(val, "Auth", &h.Auth) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &h.Metadata) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPSettings. +func (h HTTPSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forwardProxy", h.ForwardProxy) + populate(objectMap, "requireHttps", h.RequireHTTPS) + populate(objectMap, "routes", h.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPSettings. +func (h *HTTPSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "forwardProxy": + err = unpopulate(val, "ForwardProxy", &h.ForwardProxy) + delete(rawMsg, key) + case "requireHttps": + err = unpopulate(val, "RequireHTTPS", &h.RequireHTTPS) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &h.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPSettingsRoutes. +func (h HTTPSettingsRoutes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiPrefix", h.APIPrefix) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponent. -func (d *DaprComponent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPSettingsRoutes. +func (h *HTTPSettingsRoutes) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) + case "apiPrefix": + err = unpopulate(val, "APIPrefix", &h.APIPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPSecurityRestrictionRule. +func (i IPSecurityRestrictionRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", i.Action) + populate(objectMap, "description", i.Description) + populate(objectMap, "ipAddressRange", i.IPAddressRange) + populate(objectMap, "name", i.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPSecurityRestrictionRule. +func (i *IPSecurityRestrictionRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "ipAddressRange": + err = unpopulate(val, "IPAddressRange", &i.IPAddressRange) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &d.Name) + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IdentityProviders. +func (i IdentityProviders) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apple", i.Apple) + populate(objectMap, "azureActiveDirectory", i.AzureActiveDirectory) + populate(objectMap, "azureStaticWebApps", i.AzureStaticWebApps) + populate(objectMap, "customOpenIdConnectProviders", i.CustomOpenIDConnectProviders) + populate(objectMap, "facebook", i.Facebook) + populate(objectMap, "gitHub", i.GitHub) + populate(objectMap, "google", i.Google) + populate(objectMap, "twitter", i.Twitter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviders. +func (i *IdentityProviders) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apple": + err = unpopulate(val, "Apple", &i.Apple) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) + case "azureActiveDirectory": + err = unpopulate(val, "AzureActiveDirectory", &i.AzureActiveDirectory) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "azureStaticWebApps": + err = unpopulate(val, "AzureStaticWebApps", &i.AzureStaticWebApps) + delete(rawMsg, key) + case "customOpenIdConnectProviders": + err = unpopulate(val, "CustomOpenIDConnectProviders", &i.CustomOpenIDConnectProviders) + delete(rawMsg, key) + case "facebook": + err = unpopulate(val, "Facebook", &i.Facebook) + delete(rawMsg, key) + case "gitHub": + err = unpopulate(val, "GitHub", &i.GitHub) + delete(rawMsg, key) + case "google": + err = unpopulate(val, "Google", &i.Google) + delete(rawMsg, key) + case "twitter": + err = unpopulate(val, "Twitter", &i.Twitter) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DaprComponentProperties. -func (d DaprComponentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Ingress. +func (i Ingress) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "allowInsecure", i.AllowInsecure) + populate(objectMap, "clientCertificateMode", i.ClientCertificateMode) + populate(objectMap, "corsPolicy", i.CorsPolicy) + populate(objectMap, "customDomains", i.CustomDomains) + populate(objectMap, "exposedPort", i.ExposedPort) + populate(objectMap, "external", i.External) + populate(objectMap, "fqdn", i.Fqdn) + populate(objectMap, "ipSecurityRestrictions", i.IPSecurityRestrictions) + populate(objectMap, "stickySessions", i.StickySessions) + populate(objectMap, "targetPort", i.TargetPort) + populate(objectMap, "traffic", i.Traffic) + populate(objectMap, "transport", i.Transport) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentProperties. -func (d *DaprComponentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Ingress. +func (i *Ingress) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "componentType": - err = unpopulate(val, "ComponentType", &d.ComponentType) + case "allowInsecure": + err = unpopulate(val, "AllowInsecure", &i.AllowInsecure) delete(rawMsg, key) - case "ignoreErrors": - err = unpopulate(val, "IgnoreErrors", &d.IgnoreErrors) + case "clientCertificateMode": + err = unpopulate(val, "ClientCertificateMode", &i.ClientCertificateMode) delete(rawMsg, key) - case "initTimeout": - err = unpopulate(val, "InitTimeout", &d.InitTimeout) + case "corsPolicy": + err = unpopulate(val, "CorsPolicy", &i.CorsPolicy) delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) + case "customDomains": + err = unpopulate(val, "CustomDomains", &i.CustomDomains) delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &d.Scopes) + case "exposedPort": + err = unpopulate(val, "ExposedPort", &i.ExposedPort) delete(rawMsg, key) - case "secrets": - err = unpopulate(val, "Secrets", &d.Secrets) + case "external": + err = unpopulate(val, "External", &i.External) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &d.Version) + case "fqdn": + err = unpopulate(val, "Fqdn", &i.Fqdn) + delete(rawMsg, key) + case "ipSecurityRestrictions": + err = unpopulate(val, "IPSecurityRestrictions", &i.IPSecurityRestrictions) + delete(rawMsg, key) + case "stickySessions": + err = unpopulate(val, "StickySessions", &i.StickySessions) + delete(rawMsg, key) + case "targetPort": + err = unpopulate(val, "TargetPort", &i.TargetPort) + delete(rawMsg, key) + case "traffic": + err = unpopulate(val, "Traffic", &i.Traffic) + delete(rawMsg, key) + case "transport": + err = unpopulate(val, "Transport", &i.Transport) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DaprComponentsCollection. -func (d DaprComponentsCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IngressStickySessions. +func (i IngressStickySessions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "affinity", i.Affinity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentsCollection. -func (d *DaprComponentsCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IngressStickySessions. +func (i *IngressStickySessions) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + case "affinity": + err = unpopulate(val, "Affinity", &i.Affinity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InitContainer. +func (i InitContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "args", i.Args) + populate(objectMap, "command", i.Command) + populate(objectMap, "env", i.Env) + populate(objectMap, "image", i.Image) + populate(objectMap, "name", i.Name) + populate(objectMap, "resources", i.Resources) + populate(objectMap, "volumeMounts", i.VolumeMounts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InitContainer. +func (i *InitContainer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "args": + err = unpopulate(val, "Args", &i.Args) + delete(rawMsg, key) + case "command": + err = unpopulate(val, "Command", &i.Command) + delete(rawMsg, key) + case "env": + err = unpopulate(val, "Env", &i.Env) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &i.Image) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &i.Resources) + delete(rawMsg, key) + case "volumeMounts": + err = unpopulate(val, "VolumeMounts", &i.VolumeMounts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Job. +func (j Job) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", j.ID) + populate(objectMap, "identity", j.Identity) + populate(objectMap, "location", j.Location) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) + populate(objectMap, "tags", j.Tags) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Job. +func (j *Job) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &j.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &j.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &j.Properties) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "systemData": + err = unpopulate(val, "SystemData", &j.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &j.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DaprMetadata. -func (d DaprMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobConfiguration. +func (j JobConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) - populate(objectMap, "secretRef", d.SecretRef) - populate(objectMap, "value", d.Value) + populate(objectMap, "manualTriggerConfig", j.ManualTriggerConfig) + populate(objectMap, "registries", j.Registries) + populate(objectMap, "replicaRetryLimit", j.ReplicaRetryLimit) + populate(objectMap, "replicaTimeout", j.ReplicaTimeout) + populate(objectMap, "scheduleTriggerConfig", j.ScheduleTriggerConfig) + populate(objectMap, "secrets", j.Secrets) + populate(objectMap, "triggerType", j.TriggerType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DaprMetadata. -func (d *DaprMetadata) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobConfiguration. +func (j *JobConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &d.Name) + case "manualTriggerConfig": + err = unpopulate(val, "ManualTriggerConfig", &j.ManualTriggerConfig) delete(rawMsg, key) - case "secretRef": - err = unpopulate(val, "SecretRef", &d.SecretRef) + case "registries": + err = unpopulate(val, "Registries", &j.Registries) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "replicaRetryLimit": + err = unpopulate(val, "ReplicaRetryLimit", &j.ReplicaRetryLimit) + delete(rawMsg, key) + case "replicaTimeout": + err = unpopulate(val, "ReplicaTimeout", &j.ReplicaTimeout) + delete(rawMsg, key) + case "scheduleTriggerConfig": + err = unpopulate(val, "ScheduleTriggerConfig", &j.ScheduleTriggerConfig) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &j.Secrets) + delete(rawMsg, key) + case "triggerType": + err = unpopulate(val, "TriggerType", &j.TriggerType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DaprSecretsCollection. -func (d DaprSecretsCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobConfigurationManualTriggerConfig. +func (j JobConfigurationManualTriggerConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) + populate(objectMap, "parallelism", j.Parallelism) + populate(objectMap, "replicaCompletionCount", j.ReplicaCompletionCount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSecretsCollection. -func (d *DaprSecretsCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobConfigurationManualTriggerConfig. +func (j *JobConfigurationManualTriggerConfig) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &d.Value) + case "parallelism": + err = unpopulate(val, "Parallelism", &j.Parallelism) + delete(rawMsg, key) + case "replicaCompletionCount": + err = unpopulate(val, "ReplicaCompletionCount", &j.ReplicaCompletionCount) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DefaultAuthorizationPolicy. -func (d DefaultAuthorizationPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobConfigurationScheduleTriggerConfig. +func (j JobConfigurationScheduleTriggerConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowedApplications", d.AllowedApplications) - populate(objectMap, "allowedPrincipals", d.AllowedPrincipals) + populate(objectMap, "cronExpression", j.CronExpression) + populate(objectMap, "parallelism", j.Parallelism) + populate(objectMap, "replicaCompletionCount", j.ReplicaCompletionCount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultAuthorizationPolicy. -func (d *DefaultAuthorizationPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobConfigurationScheduleTriggerConfig. +func (j *JobConfigurationScheduleTriggerConfig) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "allowedApplications": - err = unpopulate(val, "AllowedApplications", &d.AllowedApplications) + case "cronExpression": + err = unpopulate(val, "CronExpression", &j.CronExpression) delete(rawMsg, key) - case "allowedPrincipals": - err = unpopulate(val, "AllowedPrincipals", &d.AllowedPrincipals) + case "parallelism": + err = unpopulate(val, "Parallelism", &j.Parallelism) + delete(rawMsg, key) + case "replicaCompletionCount": + err = unpopulate(val, "ReplicaCompletionCount", &j.ReplicaCompletionCount) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponse. -func (d DefaultErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobExecution. +func (j JobExecution) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", d.Error) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "id", j.ID) + populate(objectMap, "name", j.Name) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "status", j.Status) + populate(objectMap, "template", j.Template) + populate(objectMap, "type", j.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponse. -func (d *DefaultErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobExecution. +func (j *JobExecution) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &d.Error) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &j.EndTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &j.Template) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponseError. -func (d DefaultErrorResponseError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobExecutionBase. +func (j JobExecutionBase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "id", j.ID) + populate(objectMap, "name", j.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponseError. -func (d *DefaultErrorResponseError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobExecutionBase. +func (j *JobExecutionBase) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &d.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &d.Details) - delete(rawMsg, key) - case "innererror": - err = unpopulate(val, "Innererror", &d.Innererror) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &d.Message) + case "id": + err = unpopulate(val, "ID", &j.ID) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &d.Target) + case "name": + err = unpopulate(val, "Name", &j.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponseErrorDetailsItem. -func (d DefaultErrorResponseErrorDetailsItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobExecutionContainer. +func (j JobExecutionContainer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", d.Code) - populate(objectMap, "message", d.Message) - populate(objectMap, "target", d.Target) + populate(objectMap, "args", j.Args) + populate(objectMap, "command", j.Command) + populate(objectMap, "env", j.Env) + populate(objectMap, "image", j.Image) + populate(objectMap, "name", j.Name) + populate(objectMap, "resources", j.Resources) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponseErrorDetailsItem. -func (d *DefaultErrorResponseErrorDetailsItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobExecutionContainer. +func (j *JobExecutionContainer) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &d.Code) + case "args": + err = unpopulate(val, "Args", &j.Args) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &d.Message) + case "command": + err = unpopulate(val, "Command", &j.Command) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &d.Target) + case "env": + err = unpopulate(val, "Env", &j.Env) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &j.Image) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &j.Resources) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EnvironmentVar. -func (e EnvironmentVar) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobExecutionNamesCollection. +func (j JobExecutionNamesCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", e.Name) - populate(objectMap, "secretRef", e.SecretRef) - populate(objectMap, "value", e.Value) + populate(objectMap, "value", j.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentVar. -func (e *EnvironmentVar) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobExecutionNamesCollection. +func (j *JobExecutionNamesCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "secretRef": - err = unpopulate(val, "SecretRef", &e.SecretRef) - delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &e.Value) + err = unpopulate(val, "Value", &j.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Facebook. -func (f Facebook) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobExecutionTemplate. +func (j JobExecutionTemplate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", f.Enabled) - populate(objectMap, "graphApiVersion", f.GraphAPIVersion) - populate(objectMap, "login", f.Login) - populate(objectMap, "registration", f.Registration) + populate(objectMap, "containers", j.Containers) + populate(objectMap, "initContainers", j.InitContainers) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Facebook. -func (f *Facebook) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobExecutionTemplate. +func (j *JobExecutionTemplate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &f.Enabled) - delete(rawMsg, key) - case "graphApiVersion": - err = unpopulate(val, "GraphAPIVersion", &f.GraphAPIVersion) - delete(rawMsg, key) - case "login": - err = unpopulate(val, "Login", &f.Login) + case "containers": + err = unpopulate(val, "Containers", &j.Containers) delete(rawMsg, key) - case "registration": - err = unpopulate(val, "Registration", &f.Registration) + case "initContainers": + err = unpopulate(val, "InitContainers", &j.InitContainers) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ForwardProxy. -func (f ForwardProxy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobPatchProperties. +func (j JobPatchProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "convention", f.Convention) - populate(objectMap, "customHostHeaderName", f.CustomHostHeaderName) - populate(objectMap, "customProtoHeaderName", f.CustomProtoHeaderName) + populate(objectMap, "identity", j.Identity) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "tags", j.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ForwardProxy. -func (f *ForwardProxy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobPatchProperties. +func (j *JobPatchProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "convention": - err = unpopulate(val, "Convention", &f.Convention) + case "identity": + err = unpopulate(val, "Identity", &j.Identity) delete(rawMsg, key) - case "customHostHeaderName": - err = unpopulate(val, "CustomHostHeaderName", &f.CustomHostHeaderName) + case "properties": + err = unpopulate(val, "Properties", &j.Properties) delete(rawMsg, key) - case "customProtoHeaderName": - err = unpopulate(val, "CustomProtoHeaderName", &f.CustomProtoHeaderName) + case "tags": + err = unpopulate(val, "Tags", &j.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GitHub. -func (g GitHub) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobPatchPropertiesProperties. +func (j JobPatchPropertiesProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", g.Enabled) - populate(objectMap, "login", g.Login) - populate(objectMap, "registration", g.Registration) + populate(objectMap, "configuration", j.Configuration) + populate(objectMap, "environmentId", j.EnvironmentID) + populate(objectMap, "eventStreamEndpoint", j.EventStreamEndpoint) + populate(objectMap, "outboundIpAddresses", j.OutboundIPAddresses) + populate(objectMap, "template", j.Template) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GitHub. -func (g *GitHub) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobPatchPropertiesProperties. +func (j *JobPatchPropertiesProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &g.Enabled) + case "configuration": + err = unpopulate(val, "Configuration", &j.Configuration) delete(rawMsg, key) - case "login": - err = unpopulate(val, "Login", &g.Login) + case "environmentId": + err = unpopulate(val, "EnvironmentID", &j.EnvironmentID) delete(rawMsg, key) - case "registration": - err = unpopulate(val, "Registration", &g.Registration) + case "eventStreamEndpoint": + err = unpopulate(val, "EventStreamEndpoint", &j.EventStreamEndpoint) + delete(rawMsg, key) + case "outboundIpAddresses": + err = unpopulate(val, "OutboundIPAddresses", &j.OutboundIPAddresses) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &j.Template) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GithubActionConfiguration. -func (g GithubActionConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobProperties. +func (j JobProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureCredentials", g.AzureCredentials) - populate(objectMap, "contextPath", g.ContextPath) - populate(objectMap, "image", g.Image) - populate(objectMap, "os", g.OS) - populate(objectMap, "publishType", g.PublishType) - populate(objectMap, "registryInfo", g.RegistryInfo) - populate(objectMap, "runtimeStack", g.RuntimeStack) - populate(objectMap, "runtimeVersion", g.RuntimeVersion) + populate(objectMap, "configuration", j.Configuration) + populate(objectMap, "environmentId", j.EnvironmentID) + populate(objectMap, "eventStreamEndpoint", j.EventStreamEndpoint) + populate(objectMap, "outboundIpAddresses", j.OutboundIPAddresses) + populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "template", j.Template) + populate(objectMap, "workloadProfileName", j.WorkloadProfileName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GithubActionConfiguration. -func (g *GithubActionConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobProperties. +func (j *JobProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "azureCredentials": - err = unpopulate(val, "AzureCredentials", &g.AzureCredentials) + case "configuration": + err = unpopulate(val, "Configuration", &j.Configuration) delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &g.ContextPath) + case "environmentId": + err = unpopulate(val, "EnvironmentID", &j.EnvironmentID) delete(rawMsg, key) - case "image": - err = unpopulate(val, "Image", &g.Image) + case "eventStreamEndpoint": + err = unpopulate(val, "EventStreamEndpoint", &j.EventStreamEndpoint) delete(rawMsg, key) - case "os": - err = unpopulate(val, "OS", &g.OS) + case "outboundIpAddresses": + err = unpopulate(val, "OutboundIPAddresses", &j.OutboundIPAddresses) delete(rawMsg, key) - case "publishType": - err = unpopulate(val, "PublishType", &g.PublishType) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) delete(rawMsg, key) - case "registryInfo": - err = unpopulate(val, "RegistryInfo", &g.RegistryInfo) + case "template": + err = unpopulate(val, "Template", &j.Template) delete(rawMsg, key) - case "runtimeStack": - err = unpopulate(val, "RuntimeStack", &g.RuntimeStack) + case "workloadProfileName": + err = unpopulate(val, "WorkloadProfileName", &j.WorkloadProfileName) delete(rawMsg, key) - case "runtimeVersion": - err = unpopulate(val, "RuntimeVersion", &g.RuntimeVersion) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobSecretsCollection. +func (j JobSecretsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobSecretsCollection. +func (j *JobSecretsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &j.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GlobalValidation. -func (g GlobalValidation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobTemplate. +func (j JobTemplate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "excludedPaths", g.ExcludedPaths) - populate(objectMap, "redirectToProvider", g.RedirectToProvider) - populate(objectMap, "unauthenticatedClientAction", g.UnauthenticatedClientAction) + populate(objectMap, "containers", j.Containers) + populate(objectMap, "initContainers", j.InitContainers) + populate(objectMap, "volumes", j.Volumes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalValidation. -func (g *GlobalValidation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobTemplate. +func (j *JobTemplate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "excludedPaths": - err = unpopulate(val, "ExcludedPaths", &g.ExcludedPaths) + case "containers": + err = unpopulate(val, "Containers", &j.Containers) delete(rawMsg, key) - case "redirectToProvider": - err = unpopulate(val, "RedirectToProvider", &g.RedirectToProvider) + case "initContainers": + err = unpopulate(val, "InitContainers", &j.InitContainers) delete(rawMsg, key) - case "unauthenticatedClientAction": - err = unpopulate(val, "UnauthenticatedClientAction", &g.UnauthenticatedClientAction) + case "volumes": + err = unpopulate(val, "Volumes", &j.Volumes) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Google. -func (g Google) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobsCollection. +func (j JobsCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", g.Enabled) - populate(objectMap, "login", g.Login) - populate(objectMap, "registration", g.Registration) - populate(objectMap, "validation", g.Validation) + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Google. -func (g *Google) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobsCollection. +func (j *JobsCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &g.Enabled) - delete(rawMsg, key) - case "login": - err = unpopulate(val, "Login", &g.Login) - delete(rawMsg, key) - case "registration": - err = unpopulate(val, "Registration", &g.Registration) + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) delete(rawMsg, key) - case "validation": - err = unpopulate(val, "Validation", &g.Validation) + case "value": + err = unpopulate(val, "Value", &j.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPScaleRule. -func (h HTTPScaleRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JwtClaimChecks. +func (j JwtClaimChecks) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "auth", h.Auth) - populate(objectMap, "metadata", h.Metadata) + populate(objectMap, "allowedClientApplications", j.AllowedClientApplications) + populate(objectMap, "allowedGroups", j.AllowedGroups) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPScaleRule. -func (h *HTTPScaleRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JwtClaimChecks. +func (j *JwtClaimChecks) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "auth": - err = unpopulate(val, "Auth", &h.Auth) + case "allowedClientApplications": + err = unpopulate(val, "AllowedClientApplications", &j.AllowedClientApplications) delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &h.Metadata) + case "allowedGroups": + err = unpopulate(val, "AllowedGroups", &j.AllowedGroups) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPSettings. -func (h HTTPSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KedaConfiguration. +func (k KedaConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "forwardProxy", h.ForwardProxy) - populate(objectMap, "requireHttps", h.RequireHTTPS) - populate(objectMap, "routes", h.Routes) + populate(objectMap, "version", k.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPSettings. -func (h *HTTPSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KedaConfiguration. +func (k *KedaConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "forwardProxy": - err = unpopulate(val, "ForwardProxy", &h.ForwardProxy) - delete(rawMsg, key) - case "requireHttps": - err = unpopulate(val, "RequireHTTPS", &h.RequireHTTPS) - delete(rawMsg, key) - case "routes": - err = unpopulate(val, "Routes", &h.Routes) + case "version": + err = unpopulate(val, "Version", &k.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPSettingsRoutes. -func (h HTTPSettingsRoutes) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsConfiguration. +func (l LogAnalyticsConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiPrefix", h.APIPrefix) + populate(objectMap, "customerId", l.CustomerID) + populate(objectMap, "sharedKey", l.SharedKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPSettingsRoutes. -func (h *HTTPSettingsRoutes) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsConfiguration. +func (l *LogAnalyticsConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "apiPrefix": - err = unpopulate(val, "APIPrefix", &h.APIPrefix) + case "customerId": + err = unpopulate(val, "CustomerID", &l.CustomerID) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &l.SharedKey) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentityProviders. -func (i IdentityProviders) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Login. +func (l Login) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apple", i.Apple) - populate(objectMap, "azureActiveDirectory", i.AzureActiveDirectory) - populate(objectMap, "azureStaticWebApps", i.AzureStaticWebApps) - populate(objectMap, "customOpenIdConnectProviders", i.CustomOpenIDConnectProviders) - populate(objectMap, "facebook", i.Facebook) - populate(objectMap, "gitHub", i.GitHub) - populate(objectMap, "google", i.Google) - populate(objectMap, "twitter", i.Twitter) + populate(objectMap, "allowedExternalRedirectUrls", l.AllowedExternalRedirectUrls) + populate(objectMap, "cookieExpiration", l.CookieExpiration) + populate(objectMap, "nonce", l.Nonce) + populate(objectMap, "preserveUrlFragmentsForLogins", l.PreserveURLFragmentsForLogins) + populate(objectMap, "routes", l.Routes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProviders. -func (i *IdentityProviders) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Login. +func (l *Login) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "apple": - err = unpopulate(val, "Apple", &i.Apple) - delete(rawMsg, key) - case "azureActiveDirectory": - err = unpopulate(val, "AzureActiveDirectory", &i.AzureActiveDirectory) - delete(rawMsg, key) - case "azureStaticWebApps": - err = unpopulate(val, "AzureStaticWebApps", &i.AzureStaticWebApps) - delete(rawMsg, key) - case "customOpenIdConnectProviders": - err = unpopulate(val, "CustomOpenIDConnectProviders", &i.CustomOpenIDConnectProviders) + case "allowedExternalRedirectUrls": + err = unpopulate(val, "AllowedExternalRedirectUrls", &l.AllowedExternalRedirectUrls) delete(rawMsg, key) - case "facebook": - err = unpopulate(val, "Facebook", &i.Facebook) + case "cookieExpiration": + err = unpopulate(val, "CookieExpiration", &l.CookieExpiration) delete(rawMsg, key) - case "gitHub": - err = unpopulate(val, "GitHub", &i.GitHub) + case "nonce": + err = unpopulate(val, "Nonce", &l.Nonce) delete(rawMsg, key) - case "google": - err = unpopulate(val, "Google", &i.Google) + case "preserveUrlFragmentsForLogins": + err = unpopulate(val, "PreserveURLFragmentsForLogins", &l.PreserveURLFragmentsForLogins) delete(rawMsg, key) - case "twitter": - err = unpopulate(val, "Twitter", &i.Twitter) + case "routes": + err = unpopulate(val, "Routes", &l.Routes) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Ingress. -func (i Ingress) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoginRoutes. +func (l LoginRoutes) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "logoutEndpoint", l.LogoutEndpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Ingress. -func (i *Ingress) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoginRoutes. +func (l *LoginRoutes) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "allowInsecure": - err = unpopulate(val, "AllowInsecure", &i.AllowInsecure) - delete(rawMsg, key) - case "customDomains": - err = unpopulate(val, "CustomDomains", &i.CustomDomains) - delete(rawMsg, key) - case "external": - err = unpopulate(val, "External", &i.External) - delete(rawMsg, key) - case "fqdn": - err = unpopulate(val, "Fqdn", &i.Fqdn) - delete(rawMsg, key) - case "targetPort": - err = unpopulate(val, "TargetPort", &i.TargetPort) - delete(rawMsg, key) - case "traffic": - err = unpopulate(val, "Traffic", &i.Traffic) - delete(rawMsg, key) - case "transport": - err = unpopulate(val, "Transport", &i.Transport) + case "logoutEndpoint": + err = unpopulate(val, "LogoutEndpoint", &l.LogoutEndpoint) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type JwtClaimChecks. -func (j JwtClaimChecks) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoginScopes. +func (l LoginScopes) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowedClientApplications", j.AllowedClientApplications) - populate(objectMap, "allowedGroups", j.AllowedGroups) + populate(objectMap, "scopes", l.Scopes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type JwtClaimChecks. -func (j *JwtClaimChecks) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoginScopes. +func (l *LoginScopes) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "allowedClientApplications": - err = unpopulate(val, "AllowedClientApplications", &j.AllowedClientApplications) - delete(rawMsg, key) - case "allowedGroups": - err = unpopulate(val, "AllowedGroups", &j.AllowedGroups) + case "scopes": + err = unpopulate(val, "Scopes", &l.Scopes) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsConfiguration. -func (l LogAnalyticsConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedCertificate. +func (m ManagedCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "customerId", l.CustomerID) - populate(objectMap, "sharedKey", l.SharedKey) + 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) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsConfiguration. -func (l *LogAnalyticsConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedCertificate. +func (m *ManagedCertificate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "customerId": - err = unpopulate(val, "CustomerID", &l.CustomerID) + case "id": + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) - case "sharedKey": - err = unpopulate(val, "SharedKey", &l.SharedKey) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Login. -func (l Login) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedCertificateCollection. +func (m ManagedCertificateCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowedExternalRedirectUrls", l.AllowedExternalRedirectUrls) - populate(objectMap, "cookieExpiration", l.CookieExpiration) - populate(objectMap, "nonce", l.Nonce) - populate(objectMap, "preserveUrlFragmentsForLogins", l.PreserveURLFragmentsForLogins) - populate(objectMap, "routes", l.Routes) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Login. -func (l *Login) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedCertificateCollection. +func (m *ManagedCertificateCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "allowedExternalRedirectUrls": - err = unpopulate(val, "AllowedExternalRedirectUrls", &l.AllowedExternalRedirectUrls) - delete(rawMsg, key) - case "cookieExpiration": - err = unpopulate(val, "CookieExpiration", &l.CookieExpiration) - delete(rawMsg, key) - case "nonce": - err = unpopulate(val, "Nonce", &l.Nonce) - delete(rawMsg, key) - case "preserveUrlFragmentsForLogins": - err = unpopulate(val, "PreserveURLFragmentsForLogins", &l.PreserveURLFragmentsForLogins) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "routes": - err = unpopulate(val, "Routes", &l.Routes) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LoginRoutes. -func (l LoginRoutes) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedCertificatePatch. +func (m ManagedCertificatePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "logoutEndpoint", l.LogoutEndpoint) + populate(objectMap, "tags", m.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoginRoutes. -func (l *LoginRoutes) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedCertificatePatch. +func (m *ManagedCertificatePatch) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "logoutEndpoint": - err = unpopulate(val, "LogoutEndpoint", &l.LogoutEndpoint) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LoginScopes. -func (l LoginScopes) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedCertificateProperties. +func (m ManagedCertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "scopes", l.Scopes) + populate(objectMap, "domainControlValidation", m.DomainControlValidation) + populate(objectMap, "error", m.Error) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "subjectName", m.SubjectName) + populate(objectMap, "validationToken", m.ValidationToken) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoginScopes. -func (l *LoginScopes) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedCertificateProperties. +func (m *ManagedCertificateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "scopes": - err = unpopulate(val, "Scopes", &l.Scopes) + case "domainControlValidation": + err = unpopulate(val, "DomainControlValidation", &m.DomainControlValidation) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &m.Error) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "subjectName": + err = unpopulate(val, "SubjectName", &m.SubjectName) + delete(rawMsg, key) + case "validationToken": + err = unpopulate(val, "ValidationToken", &m.ValidationToken) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil @@ -2655,6 +5077,7 @@ func (l *LoginScopes) UnmarshalJSON(data []byte) error { func (m ManagedEnvironment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "kind", m.Kind) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -2676,6 +5099,9 @@ func (m *ManagedEnvironment) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -2706,13 +5132,19 @@ func (m *ManagedEnvironment) UnmarshalJSON(data []byte) error { func (m ManagedEnvironmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "appLogsConfiguration", m.AppLogsConfiguration) + populate(objectMap, "customDomainConfiguration", m.CustomDomainConfiguration) populate(objectMap, "daprAIConnectionString", m.DaprAIConnectionString) populate(objectMap, "daprAIInstrumentationKey", m.DaprAIInstrumentationKey) + populate(objectMap, "daprConfiguration", m.DaprConfiguration) populate(objectMap, "defaultDomain", m.DefaultDomain) populate(objectMap, "deploymentErrors", m.DeploymentErrors) + populate(objectMap, "eventStreamEndpoint", m.EventStreamEndpoint) + populate(objectMap, "infrastructureResourceGroup", m.InfrastructureResourceGroup) + populate(objectMap, "kedaConfiguration", m.KedaConfiguration) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "staticIp", m.StaticIP) populate(objectMap, "vnetConfiguration", m.VnetConfiguration) + populate(objectMap, "workloadProfiles", m.WorkloadProfiles) populate(objectMap, "zoneRedundant", m.ZoneRedundant) return json.Marshal(objectMap) } @@ -2729,18 +5161,33 @@ func (m *ManagedEnvironmentProperties) UnmarshalJSON(data []byte) error { case "appLogsConfiguration": err = unpopulate(val, "AppLogsConfiguration", &m.AppLogsConfiguration) delete(rawMsg, key) + case "customDomainConfiguration": + err = unpopulate(val, "CustomDomainConfiguration", &m.CustomDomainConfiguration) + delete(rawMsg, key) case "daprAIConnectionString": err = unpopulate(val, "DaprAIConnectionString", &m.DaprAIConnectionString) delete(rawMsg, key) case "daprAIInstrumentationKey": err = unpopulate(val, "DaprAIInstrumentationKey", &m.DaprAIInstrumentationKey) delete(rawMsg, key) + case "daprConfiguration": + err = unpopulate(val, "DaprConfiguration", &m.DaprConfiguration) + delete(rawMsg, key) case "defaultDomain": err = unpopulate(val, "DefaultDomain", &m.DefaultDomain) delete(rawMsg, key) case "deploymentErrors": err = unpopulate(val, "DeploymentErrors", &m.DeploymentErrors) delete(rawMsg, key) + case "eventStreamEndpoint": + err = unpopulate(val, "EventStreamEndpoint", &m.EventStreamEndpoint) + delete(rawMsg, key) + case "infrastructureResourceGroup": + err = unpopulate(val, "InfrastructureResourceGroup", &m.InfrastructureResourceGroup) + delete(rawMsg, key) + case "kedaConfiguration": + err = unpopulate(val, "KedaConfiguration", &m.KedaConfiguration) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) delete(rawMsg, key) @@ -2750,6 +5197,9 @@ func (m *ManagedEnvironmentProperties) UnmarshalJSON(data []byte) error { case "vnetConfiguration": err = unpopulate(val, "VnetConfiguration", &m.VnetConfiguration) delete(rawMsg, key) + case "workloadProfiles": + err = unpopulate(val, "WorkloadProfiles", &m.WorkloadProfiles) + delete(rawMsg, key) case "zoneRedundant": err = unpopulate(val, "ZoneRedundant", &m.ZoneRedundant) delete(rawMsg, key) @@ -3399,6 +5849,8 @@ func (r *ReplicaCollection) UnmarshalJSON(data []byte) error { func (r ReplicaContainer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "containerId", r.ContainerID) + populate(objectMap, "execEndpoint", r.ExecEndpoint) + populate(objectMap, "logStreamEndpoint", r.LogStreamEndpoint) populate(objectMap, "name", r.Name) populate(objectMap, "ready", r.Ready) populate(objectMap, "restartCount", r.RestartCount) @@ -3418,6 +5870,12 @@ func (r *ReplicaContainer) UnmarshalJSON(data []byte) error { case "containerId": err = unpopulate(val, "ContainerID", &r.ContainerID) delete(rawMsg, key) + case "execEndpoint": + err = unpopulate(val, "ExecEndpoint", &r.ExecEndpoint) + delete(rawMsg, key) + case "logStreamEndpoint": + err = unpopulate(val, "LogStreamEndpoint", &r.LogStreamEndpoint) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) @@ -3589,6 +6047,7 @@ func (r RevisionProperties) MarshalJSON() ([]byte, error) { populateTimeRFC3339(objectMap, "createdTime", r.CreatedTime) populate(objectMap, "fqdn", r.Fqdn) populate(objectMap, "healthState", r.HealthState) + populateTimeRFC3339(objectMap, "lastActiveTime", r.LastActiveTime) populate(objectMap, "provisioningError", r.ProvisioningError) populate(objectMap, "provisioningState", r.ProvisioningState) populate(objectMap, "replicas", r.Replicas) @@ -3618,6 +6077,9 @@ func (r *RevisionProperties) UnmarshalJSON(data []byte) error { case "healthState": err = unpopulate(val, "HealthState", &r.HealthState) delete(rawMsg, key) + case "lastActiveTime": + err = unpopulateTimeRFC3339(val, "LastActiveTime", &r.LastActiveTime) + delete(rawMsg, key) case "provisioningError": err = unpopulate(val, "ProvisioningError", &r.ProvisioningError) delete(rawMsg, key) @@ -3683,6 +6145,7 @@ func (s ScaleRule) MarshalJSON() ([]byte, error) { populate(objectMap, "custom", s.Custom) populate(objectMap, "http", s.HTTP) populate(objectMap, "name", s.Name) + populate(objectMap, "tcp", s.TCP) return json.Marshal(objectMap) } @@ -3707,6 +6170,9 @@ func (s *ScaleRule) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) + case "tcp": + err = unpopulate(val, "TCP", &s.TCP) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -3749,6 +6215,8 @@ func (s *ScaleRuleAuth) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Secret. func (s Secret) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "keyVaultUrl", s.KeyVaultURL) populate(objectMap, "name", s.Name) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -3763,6 +6231,12 @@ func (s *Secret) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "keyVaultUrl": + err = unpopulate(val, "KeyVaultURL", &s.KeyVaultURL) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) @@ -3777,6 +6251,37 @@ func (s *Secret) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SecretVolumeItem. +func (s SecretVolumeItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "path", s.Path) + populate(objectMap, "secretRef", s.SecretRef) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretVolumeItem. +func (s *SecretVolumeItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "path": + err = unpopulate(val, "Path", &s.Path) + delete(rawMsg, key) + case "secretRef": + err = unpopulate(val, "SecretRef", &s.SecretRef) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SecretsCollection. func (s SecretsCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3964,10 +6469,42 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TCPScaleRule. +func (t TCPScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "auth", t.Auth) + populate(objectMap, "metadata", t.Metadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TCPScaleRule. +func (t *TCPScaleRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auth": + err = unpopulate(val, "Auth", &t.Auth) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &t.Metadata) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Template. func (t Template) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "containers", t.Containers) + populate(objectMap, "initContainers", t.InitContainers) populate(objectMap, "revisionSuffix", t.RevisionSuffix) populate(objectMap, "scale", t.Scale) populate(objectMap, "volumes", t.Volumes) @@ -3986,6 +6523,9 @@ func (t *Template) UnmarshalJSON(data []byte) error { case "containers": err = unpopulate(val, "Containers", &t.Containers) delete(rawMsg, key) + case "initContainers": + err = unpopulate(val, "InitContainers", &t.InitContainers) + delete(rawMsg, key) case "revisionSuffix": err = unpopulate(val, "RevisionSuffix", &t.RevisionSuffix) delete(rawMsg, key) @@ -4190,7 +6730,6 @@ func (v VnetConfiguration) MarshalJSON() ([]byte, error) { populate(objectMap, "internal", v.Internal) populate(objectMap, "platformReservedCidr", v.PlatformReservedCidr) populate(objectMap, "platformReservedDnsIP", v.PlatformReservedDNSIP) - populate(objectMap, "runtimeSubnetId", v.RuntimeSubnetID) return json.Marshal(objectMap) } @@ -4218,9 +6757,6 @@ func (v *VnetConfiguration) UnmarshalJSON(data []byte) error { case "platformReservedDnsIP": err = unpopulate(val, "PlatformReservedDNSIP", &v.PlatformReservedDNSIP) delete(rawMsg, key) - case "runtimeSubnetId": - err = unpopulate(val, "RuntimeSubnetID", &v.RuntimeSubnetID) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -4233,6 +6769,7 @@ func (v *VnetConfiguration) UnmarshalJSON(data []byte) error { func (v Volume) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", v.Name) + populate(objectMap, "secrets", v.Secrets) populate(objectMap, "storageName", v.StorageName) populate(objectMap, "storageType", v.StorageType) return json.Marshal(objectMap) @@ -4250,6 +6787,9 @@ func (v *Volume) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &v.Secrets) + delete(rawMsg, key) case "storageName": err = unpopulate(val, "StorageName", &v.StorageName) delete(rawMsg, key) @@ -4295,6 +6835,154 @@ func (v *VolumeMount) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type WorkloadProfile. +func (w WorkloadProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maximumCount", w.MaximumCount) + populate(objectMap, "minimumCount", w.MinimumCount) + populate(objectMap, "name", w.Name) + populate(objectMap, "workloadProfileType", w.WorkloadProfileType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadProfile. +func (w *WorkloadProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maximumCount": + err = unpopulate(val, "MaximumCount", &w.MaximumCount) + delete(rawMsg, key) + case "minimumCount": + err = unpopulate(val, "MinimumCount", &w.MinimumCount) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "workloadProfileType": + err = unpopulate(val, "WorkloadProfileType", &w.WorkloadProfileType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadProfileStates. +func (w WorkloadProfileStates) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadProfileStates. +func (w *WorkloadProfileStates) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadProfileStatesCollection. +func (w WorkloadProfileStatesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadProfileStatesCollection. +func (w *WorkloadProfileStatesCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkloadProfileStatesProperties. +func (w WorkloadProfileStatesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentCount", w.CurrentCount) + populate(objectMap, "maximumCount", w.MaximumCount) + populate(objectMap, "minimumCount", w.MinimumCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadProfileStatesProperties. +func (w *WorkloadProfileStatesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentCount": + err = unpopulate(val, "CurrentCount", &w.CurrentCount) + delete(rawMsg, key) + case "maximumCount": + err = unpopulate(val, "MaximumCount", &w.MaximumCount) + delete(rawMsg, key) + case "minimumCount": + err = unpopulate(val, "MinimumCount", &w.MinimumCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return @@ -4305,6 +6993,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func populateByteArray(m map[string]any, k string, b []byte, f runtime.Base64Encoding) { if azcore.IsNullValue(b) { m[k] = nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go index 42f125f1b113..d7db6999cd98 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go @@ -47,7 +47,7 @@ func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredentia // CheckNameAvailability - Checks if resource name is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - checkNameAvailabilityRequest - The check name availability request. @@ -88,7 +88,7 @@ func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go index 77dc19d2ffff..622c13300263 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Certificates_CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_CheckNameAvailability.json func ExampleNamespacesClient_CheckNameAvailability_certificatesCheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,7 +46,7 @@ func ExampleNamespacesClient_CheckNameAvailability_certificatesCheckNameAvailabi // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/ContainerApps_CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CheckNameAvailability.json func ExampleNamespacesClient_CheckNameAvailability_containerAppsCheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go index f7f9180caf95..0fca3ccef2ce 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available RP operations. // -// Generated from API version 2022-03-01 +// Generated from API version 2022-11-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +78,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client_example_test.go index 17df72747dfd..49af50a75aef 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9a65970ef1837c0af1800c906aa365ba95871b26/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc/specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/response_types.go b/sdk/resourcemanager/appcontainers/armappcontainers/response_types.go index 657fb45ff4a6..c40847d25228 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/response_types.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/response_types.go @@ -9,6 +9,16 @@ package armappcontainers +// AvailableWorkloadProfilesClientGetResponse contains the response from method AvailableWorkloadProfilesClient.NewGetPager. +type AvailableWorkloadProfilesClientGetResponse struct { + AvailableWorkloadProfilesCollection +} + +// BillingMetersClientGetResponse contains the response from method BillingMetersClient.Get. +type BillingMetersClientGetResponse struct { + BillingMeterCollection +} + // CertificatesClientCreateOrUpdateResponse contains the response from method CertificatesClient.CreateOrUpdate. type CertificatesClientCreateOrUpdateResponse struct { Certificate @@ -34,6 +44,111 @@ type CertificatesClientUpdateResponse struct { Certificate } +// ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsCertificatesClient.CreateOrUpdate. +type ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse struct { + Certificate +} + +// ConnectedEnvironmentsCertificatesClientDeleteResponse contains the response from method ConnectedEnvironmentsCertificatesClient.Delete. +type ConnectedEnvironmentsCertificatesClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectedEnvironmentsCertificatesClientGetResponse contains the response from method ConnectedEnvironmentsCertificatesClient.Get. +type ConnectedEnvironmentsCertificatesClientGetResponse struct { + Certificate +} + +// ConnectedEnvironmentsCertificatesClientListResponse contains the response from method ConnectedEnvironmentsCertificatesClient.NewListPager. +type ConnectedEnvironmentsCertificatesClientListResponse struct { + CertificateCollection +} + +// ConnectedEnvironmentsCertificatesClientUpdateResponse contains the response from method ConnectedEnvironmentsCertificatesClient.Update. +type ConnectedEnvironmentsCertificatesClientUpdateResponse struct { + Certificate +} + +// ConnectedEnvironmentsClientCheckNameAvailabilityResponse contains the response from method ConnectedEnvironmentsClient.CheckNameAvailability. +type ConnectedEnvironmentsClientCheckNameAvailabilityResponse struct { + CheckNameAvailabilityResponse +} + +// ConnectedEnvironmentsClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsClient.BeginCreateOrUpdate. +type ConnectedEnvironmentsClientCreateOrUpdateResponse struct { + ConnectedEnvironment +} + +// ConnectedEnvironmentsClientDeleteResponse contains the response from method ConnectedEnvironmentsClient.BeginDelete. +type ConnectedEnvironmentsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectedEnvironmentsClientGetResponse contains the response from method ConnectedEnvironmentsClient.Get. +type ConnectedEnvironmentsClientGetResponse struct { + ConnectedEnvironment +} + +// ConnectedEnvironmentsClientListByResourceGroupResponse contains the response from method ConnectedEnvironmentsClient.NewListByResourceGroupPager. +type ConnectedEnvironmentsClientListByResourceGroupResponse struct { + ConnectedEnvironmentCollection +} + +// ConnectedEnvironmentsClientListBySubscriptionResponse contains the response from method ConnectedEnvironmentsClient.NewListBySubscriptionPager. +type ConnectedEnvironmentsClientListBySubscriptionResponse struct { + ConnectedEnvironmentCollection +} + +// ConnectedEnvironmentsClientUpdateResponse contains the response from method ConnectedEnvironmentsClient.Update. +type ConnectedEnvironmentsClientUpdateResponse struct { + ConnectedEnvironment +} + +// ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate. +type ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse struct { + DaprComponent +} + +// ConnectedEnvironmentsDaprComponentsClientDeleteResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.Delete. +type ConnectedEnvironmentsDaprComponentsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectedEnvironmentsDaprComponentsClientGetResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.Get. +type ConnectedEnvironmentsDaprComponentsClientGetResponse struct { + DaprComponent +} + +// ConnectedEnvironmentsDaprComponentsClientListResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.NewListPager. +type ConnectedEnvironmentsDaprComponentsClientListResponse struct { + DaprComponentsCollection +} + +// ConnectedEnvironmentsDaprComponentsClientListSecretsResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.ListSecrets. +type ConnectedEnvironmentsDaprComponentsClientListSecretsResponse struct { + DaprSecretsCollection +} + +// ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsStoragesClient.CreateOrUpdate. +type ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse struct { + ConnectedEnvironmentStorage +} + +// ConnectedEnvironmentsStoragesClientDeleteResponse contains the response from method ConnectedEnvironmentsStoragesClient.Delete. +type ConnectedEnvironmentsStoragesClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectedEnvironmentsStoragesClientGetResponse contains the response from method ConnectedEnvironmentsStoragesClient.Get. +type ConnectedEnvironmentsStoragesClientGetResponse struct { + ConnectedEnvironmentStorage +} + +// ConnectedEnvironmentsStoragesClientListResponse contains the response from method ConnectedEnvironmentsStoragesClient.List. +type ConnectedEnvironmentsStoragesClientListResponse struct { + ConnectedEnvironmentStoragesCollection +} + // ContainerAppsAuthConfigsClientCreateOrUpdateResponse contains the response from method ContainerAppsAuthConfigsClient.CreateOrUpdate. type ContainerAppsAuthConfigsClientCreateOrUpdateResponse struct { AuthConfig @@ -64,6 +179,11 @@ type ContainerAppsClientDeleteResponse struct { // placeholder for future response values } +// ContainerAppsClientGetAuthTokenResponse contains the response from method ContainerAppsClient.GetAuthToken. +type ContainerAppsClientGetAuthTokenResponse struct { + ContainerAppAuthToken +} + // ContainerAppsClientGetResponse contains the response from method ContainerAppsClient.Get. type ContainerAppsClientGetResponse struct { ContainerApp @@ -91,7 +211,32 @@ type ContainerAppsClientListSecretsResponse struct { // ContainerAppsClientUpdateResponse contains the response from method ContainerAppsClient.BeginUpdate. type ContainerAppsClientUpdateResponse struct { - // placeholder for future response values + ContainerApp +} + +// ContainerAppsDiagnosticsClientGetDetectorResponse contains the response from method ContainerAppsDiagnosticsClient.GetDetector. +type ContainerAppsDiagnosticsClientGetDetectorResponse struct { + Diagnostics +} + +// ContainerAppsDiagnosticsClientGetRevisionResponse contains the response from method ContainerAppsDiagnosticsClient.GetRevision. +type ContainerAppsDiagnosticsClientGetRevisionResponse struct { + Revision +} + +// ContainerAppsDiagnosticsClientGetRootResponse contains the response from method ContainerAppsDiagnosticsClient.GetRoot. +type ContainerAppsDiagnosticsClientGetRootResponse struct { + ContainerApp +} + +// ContainerAppsDiagnosticsClientListDetectorsResponse contains the response from method ContainerAppsDiagnosticsClient.NewListDetectorsPager. +type ContainerAppsDiagnosticsClientListDetectorsResponse struct { + DiagnosticsCollection +} + +// ContainerAppsDiagnosticsClientListRevisionsResponse contains the response from method ContainerAppsDiagnosticsClient.NewListRevisionsPager. +type ContainerAppsDiagnosticsClientListRevisionsResponse struct { + RevisionCollection } // ContainerAppsRevisionReplicasClientGetReplicaResponse contains the response from method ContainerAppsRevisionReplicasClient.GetReplica. @@ -174,6 +319,96 @@ type DaprComponentsClientListSecretsResponse struct { DaprSecretsCollection } +// JobsClientCreateOrUpdateResponse contains the response from method JobsClient.BeginCreateOrUpdate. +type JobsClientCreateOrUpdateResponse struct { + Job +} + +// JobsClientDeleteResponse contains the response from method JobsClient.BeginDelete. +type JobsClientDeleteResponse struct { + // placeholder for future response values +} + +// JobsClientGetResponse contains the response from method JobsClient.Get. +type JobsClientGetResponse struct { + Job +} + +// JobsClientListByResourceGroupResponse contains the response from method JobsClient.NewListByResourceGroupPager. +type JobsClientListByResourceGroupResponse struct { + JobsCollection +} + +// JobsClientListBySubscriptionResponse contains the response from method JobsClient.NewListBySubscriptionPager. +type JobsClientListBySubscriptionResponse struct { + JobsCollection +} + +// JobsClientListSecretsResponse contains the response from method JobsClient.ListSecrets. +type JobsClientListSecretsResponse struct { + JobSecretsCollection +} + +// JobsClientStartResponse contains the response from method JobsClient.BeginStart. +type JobsClientStartResponse struct { + JobExecutionBase +} + +// JobsClientStopExecutionResponse contains the response from method JobsClient.BeginStopExecution. +type JobsClientStopExecutionResponse struct { + // placeholder for future response values +} + +// JobsClientStopMultipleExecutionsResponse contains the response from method JobsClient.BeginStopMultipleExecutions. +type JobsClientStopMultipleExecutionsResponse struct { + ContainerAppJobExecutions +} + +// JobsClientUpdateResponse contains the response from method JobsClient.BeginUpdate. +type JobsClientUpdateResponse struct { + Job +} + +// JobsExecutionsClientListResponse contains the response from method JobsExecutionsClient.NewListPager. +type JobsExecutionsClientListResponse struct { + ContainerAppJobExecutions +} + +// ManagedCertificatesClientCreateOrUpdateResponse contains the response from method ManagedCertificatesClient.BeginCreateOrUpdate. +type ManagedCertificatesClientCreateOrUpdateResponse struct { + ManagedCertificate +} + +// ManagedCertificatesClientDeleteResponse contains the response from method ManagedCertificatesClient.Delete. +type ManagedCertificatesClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedCertificatesClientGetResponse contains the response from method ManagedCertificatesClient.Get. +type ManagedCertificatesClientGetResponse struct { + ManagedCertificate +} + +// ManagedCertificatesClientListResponse contains the response from method ManagedCertificatesClient.NewListPager. +type ManagedCertificatesClientListResponse struct { + ManagedCertificateCollection +} + +// ManagedCertificatesClientUpdateResponse contains the response from method ManagedCertificatesClient.Update. +type ManagedCertificatesClientUpdateResponse struct { + ManagedCertificate +} + +// ManagedEnvironmentDiagnosticsClientGetDetectorResponse contains the response from method ManagedEnvironmentDiagnosticsClient.GetDetector. +type ManagedEnvironmentDiagnosticsClientGetDetectorResponse struct { + Diagnostics +} + +// ManagedEnvironmentDiagnosticsClientListDetectorsResponse contains the response from method ManagedEnvironmentDiagnosticsClient.ListDetectors. +type ManagedEnvironmentDiagnosticsClientListDetectorsResponse struct { + DiagnosticsCollection +} + // ManagedEnvironmentsClientCreateOrUpdateResponse contains the response from method ManagedEnvironmentsClient.BeginCreateOrUpdate. type ManagedEnvironmentsClientCreateOrUpdateResponse struct { ManagedEnvironment @@ -184,6 +419,11 @@ type ManagedEnvironmentsClientDeleteResponse struct { // placeholder for future response values } +// ManagedEnvironmentsClientGetAuthTokenResponse contains the response from method ManagedEnvironmentsClient.GetAuthToken. +type ManagedEnvironmentsClientGetAuthTokenResponse struct { + EnvironmentAuthToken +} + // ManagedEnvironmentsClientGetResponse contains the response from method ManagedEnvironmentsClient.Get. type ManagedEnvironmentsClientGetResponse struct { ManagedEnvironment @@ -199,9 +439,19 @@ type ManagedEnvironmentsClientListBySubscriptionResponse struct { ManagedEnvironmentsCollection } +// ManagedEnvironmentsClientListWorkloadProfileStatesResponse contains the response from method ManagedEnvironmentsClient.NewListWorkloadProfileStatesPager. +type ManagedEnvironmentsClientListWorkloadProfileStatesResponse struct { + WorkloadProfileStatesCollection +} + // ManagedEnvironmentsClientUpdateResponse contains the response from method ManagedEnvironmentsClient.BeginUpdate. type ManagedEnvironmentsClientUpdateResponse struct { - // placeholder for future response values + ManagedEnvironment +} + +// ManagedEnvironmentsDiagnosticsClientGetRootResponse contains the response from method ManagedEnvironmentsDiagnosticsClient.GetRoot. +type ManagedEnvironmentsDiagnosticsClientGetRootResponse struct { + ManagedEnvironment } // ManagedEnvironmentsStoragesClientCreateOrUpdateResponse contains the response from method ManagedEnvironmentsStoragesClient.CreateOrUpdate.