diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md b/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md index de3024fb26a8..63d4ba28b59a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md +++ b/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md @@ -1,5 +1,80 @@ # Release History +## 3.1.0-beta.2 (2024-11-11) +### Breaking Changes + +- Operation `*ConnectedEnvironmentsCertificatesClient.CreateOrUpdate` has been changed to LRO, use `*ConnectedEnvironmentsCertificatesClient.BeginCreateOrUpdate` instead. +- Operation `*ConnectedEnvironmentsCertificatesClient.Delete` has been changed to LRO, use `*ConnectedEnvironmentsCertificatesClient.BeginDelete` instead. +- Operation `*ConnectedEnvironmentsCertificatesClient.Update` has been changed to LRO, use `*ConnectedEnvironmentsCertificatesClient.BeginUpdate` instead. +- Operation `*ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate` has been changed to LRO, use `*ConnectedEnvironmentsDaprComponentsClient.BeginCreateOrUpdate` instead. +- Operation `*ConnectedEnvironmentsDaprComponentsClient.Delete` has been changed to LRO, use `*ConnectedEnvironmentsDaprComponentsClient.BeginDelete` instead. +- Operation `*ConnectedEnvironmentsStoragesClient.CreateOrUpdate` has been changed to LRO, use `*ConnectedEnvironmentsStoragesClient.BeginCreateOrUpdate` instead. +- Operation `*ConnectedEnvironmentsStoragesClient.Delete` has been changed to LRO, use `*ConnectedEnvironmentsStoragesClient.BeginDelete` instead. +- Field `DaprComponent` of struct `ConnectedEnvironmentsDaprComponentsClientGetResponse` has been removed +- Field `DaprComponentsCollection` of struct `ConnectedEnvironmentsDaprComponentsClientListResponse` has been removed + +### Features Added + +- New value `ActiveRevisionsModeLabels` added to enum type `ActiveRevisionsMode` +- New value `BindingTypeAuto` added to enum type `BindingType` +- New enum type `ConnectedEnvironmentDaprComponentProvisioningState` with values `ConnectedEnvironmentDaprComponentProvisioningStateCanceled`, `ConnectedEnvironmentDaprComponentProvisioningStateFailed`, `ConnectedEnvironmentDaprComponentProvisioningStateInProgress`, `ConnectedEnvironmentDaprComponentProvisioningStateSucceeded` +- New enum type `ConnectedEnvironmentStorageProvisioningState` with values `ConnectedEnvironmentStorageProvisioningStateCanceled`, `ConnectedEnvironmentStorageProvisioningStateFailed`, `ConnectedEnvironmentStorageProvisioningStateInProgress`, `ConnectedEnvironmentStorageProvisioningStateSucceeded` +- New enum type `ContainerAppRunningStatus` with values `ContainerAppRunningStatusProgressing`, `ContainerAppRunningStatusReady`, `ContainerAppRunningStatusRunning`, `ContainerAppRunningStatusStopped`, `ContainerAppRunningStatusSuspended` +- New enum type `HTTPRouteProvisioningState` with values `HTTPRouteProvisioningStateCanceled`, `HTTPRouteProvisioningStateDeleting`, `HTTPRouteProvisioningStateFailed`, `HTTPRouteProvisioningStatePending`, `HTTPRouteProvisioningStateSucceeded`, `HTTPRouteProvisioningStateUpdating`, `HTTPRouteProvisioningStateWaiting` +- New enum type `WeekDay` with values `WeekDayEveryday`, `WeekDayFriday`, `WeekDayMonday`, `WeekDaySaturday`, `WeekDaySunday`, `WeekDayThursday`, `WeekDayTuesday`, `WeekDayWednesday`, `WeekDayWeekend` +- New function `*ClientFactory.NewContainerAppsLabelHistoryClient() *ContainerAppsLabelHistoryClient` +- New function `*ClientFactory.NewHTTPRouteConfigClient() *HTTPRouteConfigClient` +- New function `*ClientFactory.NewMaintenanceConfigurationsClient() *MaintenanceConfigurationsClient` +- New function `NewContainerAppsLabelHistoryClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContainerAppsLabelHistoryClient, error)` +- New function `*ContainerAppsLabelHistoryClient.GetLabelHistory(context.Context, string, string, string, *ContainerAppsLabelHistoryClientGetLabelHistoryOptions) (ContainerAppsLabelHistoryClientGetLabelHistoryResponse, error)` +- New function `*ContainerAppsLabelHistoryClient.NewListLabelHistoryPager(string, string, *ContainerAppsLabelHistoryClientListLabelHistoryOptions) *runtime.Pager[ContainerAppsLabelHistoryClientListLabelHistoryResponse]` +- New function `NewHTTPRouteConfigClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HTTPRouteConfigClient, error)` +- New function `*HTTPRouteConfigClient.CreateOrUpdate(context.Context, string, string, string, *HTTPRouteConfigClientCreateOrUpdateOptions) (HTTPRouteConfigClientCreateOrUpdateResponse, error)` +- New function `*HTTPRouteConfigClient.Delete(context.Context, string, string, string, *HTTPRouteConfigClientDeleteOptions) (HTTPRouteConfigClientDeleteResponse, error)` +- New function `*HTTPRouteConfigClient.Get(context.Context, string, string, string, *HTTPRouteConfigClientGetOptions) (HTTPRouteConfigClientGetResponse, error)` +- New function `*HTTPRouteConfigClient.NewListPager(string, string, *HTTPRouteConfigClientListOptions) *runtime.Pager[HTTPRouteConfigClientListResponse]` +- New function `*HTTPRouteConfigClient.Update(context.Context, string, string, string, HTTPRouteConfig, *HTTPRouteConfigClientUpdateOptions) (HTTPRouteConfigClientUpdateResponse, error)` +- New function `NewMaintenanceConfigurationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MaintenanceConfigurationsClient, error)` +- New function `*MaintenanceConfigurationsClient.CreateOrUpdate(context.Context, string, string, string, MaintenanceConfigurationResource, *MaintenanceConfigurationsClientCreateOrUpdateOptions) (MaintenanceConfigurationsClientCreateOrUpdateResponse, error)` +- New function `*MaintenanceConfigurationsClient.Delete(context.Context, string, string, string, *MaintenanceConfigurationsClientDeleteOptions) (MaintenanceConfigurationsClientDeleteResponse, error)` +- New function `*MaintenanceConfigurationsClient.Get(context.Context, string, string, string, *MaintenanceConfigurationsClientGetOptions) (MaintenanceConfigurationsClientGetResponse, error)` +- New function `*MaintenanceConfigurationsClient.NewListPager(string, string, *MaintenanceConfigurationsClientListOptions) *runtime.Pager[MaintenanceConfigurationsClientListResponse]` +- New struct `ConnectedEnvironmentDaprComponent` +- New struct `ConnectedEnvironmentDaprComponentProperties` +- New struct `ConnectedEnvironmentDaprComponentsCollection` +- New struct `HTTPRoute` +- New struct `HTTPRouteAction` +- New struct `HTTPRouteConfig` +- New struct `HTTPRouteConfigCollection` +- New struct `HTTPRouteConfigProperties` +- New struct `HTTPRouteMatch` +- New struct `HTTPRouteProvisioningErrors` +- New struct `HTTPRouteRule` +- New struct `HTTPRouteTarget` +- New struct `LabelHistory` +- New struct `LabelHistoryCollection` +- New struct `LabelHistoryProperties` +- New struct `LabelHistoryRecordItem` +- New struct `MaintenanceConfigurationCollection` +- New struct `MaintenanceConfigurationResource` +- New struct `ManagedIdentitySetting` +- New struct `ScheduledEntries` +- New struct `ScheduledEntry` +- New field `BlobContainerURI`, `ClientID`, `ManagedIdentityResourceID` in struct `BlobStorageTokenStore` +- New field `DeploymentErrors` in struct `CertificateProperties` +- New field `RevisionTransitionThreshold`, `TargetLabel` in struct `Configuration` +- New field `DeploymentErrors`, `ProvisioningState` in struct `ConnectedEnvironmentStorageProperties` +- New anonymous field `ConnectedEnvironmentDaprComponent` in struct `ConnectedEnvironmentsDaprComponentsClientGetResponse` +- New anonymous field `ConnectedEnvironmentDaprComponentsCollection` in struct `ConnectedEnvironmentsDaprComponentsClientListResponse` +- New field `RunningStatus` in struct `ContainerAppProperties` +- New field `Gpu` in struct `ContainerResources` +- New field `AvailabilityZones`, `PrivateLinkDefaultDomain` in struct `ManagedEnvironmentProperties` +- New field `Labels` in struct `RevisionProperties` +- New field `Identity` in struct `SessionPool` +- New field `ManagedIdentitySettings` in struct `SessionPoolProperties` +- New field `Identity` in struct `SessionPoolUpdatableProperties` + + ## 3.1.0-beta.1 (2024-10-23) ### Features Added diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client.go index 8cf2a619e848..8890b326b1b5 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // AppResiliencyClient contains the methods for the AppResiliency group. @@ -47,7 +46,7 @@ func NewAppResiliencyClient(subscriptionID string, credential azcore.TokenCreden // CreateOrUpdate - Create or update container app resiliency policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - appName - Name of the Container App. // - name - Name of the resiliency policy. @@ -100,7 +99,7 @@ func (client *AppResiliencyClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resiliencyEnvelope); err != nil { @@ -121,7 +120,7 @@ func (client *AppResiliencyClient) createOrUpdateHandleResponse(resp *http.Respo // Delete - Delete container app resiliency policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - appName - Name of the Container App. // - name - Name of the resiliency policy. @@ -171,7 +170,7 @@ func (client *AppResiliencyClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +179,7 @@ func (client *AppResiliencyClient) deleteCreateRequest(ctx context.Context, reso // Get - Get container app resiliency policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - appName - Name of the Container App. // - name - Name of the resiliency policy. @@ -231,7 +230,7 @@ func (client *AppResiliencyClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +247,7 @@ func (client *AppResiliencyClient) getHandleResponse(resp *http.Response) (AppRe // NewListPager - List container app resiliency policies. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - appName - Name of the Container App. // - options - AppResiliencyClientListOptions contains the optional parameters for the AppResiliencyClient.NewListPager method. @@ -295,7 +294,7 @@ func (client *AppResiliencyClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,7 +312,7 @@ func (client *AppResiliencyClient) listHandleResponse(resp *http.Response) (AppR // Update - Update container app resiliency policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - appName - Name of the Container App. // - name - Name of the resiliency policy. @@ -365,7 +364,7 @@ func (client *AppResiliencyClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resiliencyEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client_example_test.go deleted file mode 100644 index be83e6036857..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client_example_test.go +++ /dev/null @@ -1,382 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_CreateOrUpdate.json -func ExampleAppResiliencyClient_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.NewAppResiliencyClient().CreateOrUpdate(ctx, "rg", "testcontainerApp0", "resiliency-policy-1", armappcontainers.AppResiliency{ - Properties: &armappcontainers.AppResiliencyProperties{ - CircuitBreakerPolicy: &armappcontainers.CircuitBreakerPolicy{ - ConsecutiveErrors: to.Ptr[int32](5), - IntervalInSeconds: to.Ptr[int32](10), - MaxEjectionPercent: to.Ptr[int32](50), - }, - HTTPConnectionPool: &armappcontainers.HTTPConnectionPool{ - HTTP1MaxPendingRequests: to.Ptr[int32](1024), - HTTP2MaxRequests: to.Ptr[int32](1024), - }, - HTTPRetryPolicy: &armappcontainers.HTTPRetryPolicy{ - Matches: &armappcontainers.HTTPRetryPolicyMatches{ - Errors: []*string{ - to.Ptr("5xx"), - to.Ptr("connect-failure"), - to.Ptr("reset"), - to.Ptr("retriable-headers"), - to.Ptr("retriable-status-codes")}, - Headers: []*armappcontainers.HeaderMatch{ - { - Header: to.Ptr("X-Content-Type"), - Match: &armappcontainers.HeaderMatchMatch{ - PrefixMatch: to.Ptr("GOATS"), - }, - }}, - HTTPStatusCodes: []*int32{ - to.Ptr[int32](502), - to.Ptr[int32](503)}, - }, - MaxRetries: to.Ptr[int32](5), - RetryBackOff: &armappcontainers.HTTPRetryPolicyRetryBackOff{ - InitialDelayInMilliseconds: to.Ptr[int64](1000), - MaxIntervalInMilliseconds: to.Ptr[int64](10000), - }, - }, - TCPConnectionPool: &armappcontainers.TCPConnectionPool{ - MaxConnections: to.Ptr[int32](100), - }, - TCPRetryPolicy: &armappcontainers.TCPRetryPolicy{ - MaxConnectAttempts: to.Ptr[int32](3), - }, - TimeoutPolicy: &armappcontainers.TimeoutPolicy{ - ConnectionTimeoutInSeconds: to.Ptr[int32](5), - ResponseTimeoutInSeconds: to.Ptr[int32](15), - }, - }, - }, 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.AppResiliency = armappcontainers.AppResiliency{ - // Name: to.Ptr("resiliency-policy-1"), - // Type: to.Ptr("Microsoft.App/containerApps/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0/resiliencyPolicies/resiliency-policy-1"), - // Properties: &armappcontainers.AppResiliencyProperties{ - // CircuitBreakerPolicy: &armappcontainers.CircuitBreakerPolicy{ - // ConsecutiveErrors: to.Ptr[int32](5), - // IntervalInSeconds: to.Ptr[int32](10), - // MaxEjectionPercent: to.Ptr[int32](50), - // }, - // HTTPConnectionPool: &armappcontainers.HTTPConnectionPool{ - // HTTP1MaxPendingRequests: to.Ptr[int32](1024), - // HTTP2MaxRequests: to.Ptr[int32](1024), - // }, - // HTTPRetryPolicy: &armappcontainers.HTTPRetryPolicy{ - // Matches: &armappcontainers.HTTPRetryPolicyMatches{ - // Errors: []*string{ - // to.Ptr("5xx"), - // to.Ptr("connect-failure"), - // to.Ptr("reset"), - // to.Ptr("retriable-headers"), - // to.Ptr("retriable-status-codes")}, - // Headers: []*armappcontainers.HeaderMatch{ - // { - // Header: to.Ptr("X-Content-Type"), - // Match: &armappcontainers.HeaderMatchMatch{ - // PrefixMatch: to.Ptr("GOATS"), - // }, - // }}, - // HTTPStatusCodes: []*int32{ - // to.Ptr[int32](502), - // to.Ptr[int32](503)}, - // }, - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.HTTPRetryPolicyRetryBackOff{ - // InitialDelayInMilliseconds: to.Ptr[int64](1000), - // MaxIntervalInMilliseconds: to.Ptr[int64](10000), - // }, - // }, - // TCPConnectionPool: &armappcontainers.TCPConnectionPool{ - // MaxConnections: to.Ptr[int32](100), - // }, - // TCPRetryPolicy: &armappcontainers.TCPRetryPolicy{ - // MaxConnectAttempts: to.Ptr[int32](3), - // }, - // TimeoutPolicy: &armappcontainers.TimeoutPolicy{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](5), - // ResponseTimeoutInSeconds: to.Ptr[int32](15), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Patch.json -func ExampleAppResiliencyClient_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.NewAppResiliencyClient().Update(ctx, "rg", "testcontainerApp0", "resiliency-policy-1", armappcontainers.AppResiliency{ - Properties: &armappcontainers.AppResiliencyProperties{ - TimeoutPolicy: &armappcontainers.TimeoutPolicy{ - ConnectionTimeoutInSeconds: to.Ptr[int32](40), - ResponseTimeoutInSeconds: to.Ptr[int32](30), - }, - }, - }, 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.AppResiliency = armappcontainers.AppResiliency{ - // Name: to.Ptr("resiliency-policy-1"), - // Type: to.Ptr("Microsoft.App/containerApps/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0/resiliencyPolicies/resiliency-policy-1"), - // Properties: &armappcontainers.AppResiliencyProperties{ - // CircuitBreakerPolicy: &armappcontainers.CircuitBreakerPolicy{ - // ConsecutiveErrors: to.Ptr[int32](5), - // IntervalInSeconds: to.Ptr[int32](10), - // MaxEjectionPercent: to.Ptr[int32](50), - // }, - // HTTPConnectionPool: &armappcontainers.HTTPConnectionPool{ - // HTTP1MaxPendingRequests: to.Ptr[int32](1024), - // HTTP2MaxRequests: to.Ptr[int32](1024), - // }, - // HTTPRetryPolicy: &armappcontainers.HTTPRetryPolicy{ - // Matches: &armappcontainers.HTTPRetryPolicyMatches{ - // Errors: []*string{ - // to.Ptr("5xx"), - // to.Ptr("connect-failure"), - // to.Ptr("reset"), - // to.Ptr("retriable-headers"), - // to.Ptr("retriable-status-codes")}, - // Headers: []*armappcontainers.HeaderMatch{ - // { - // Header: to.Ptr("X-Content-Type"), - // Match: &armappcontainers.HeaderMatchMatch{ - // PrefixMatch: to.Ptr("GOATS"), - // }, - // }}, - // HTTPStatusCodes: []*int32{ - // to.Ptr[int32](502), - // to.Ptr[int32](503)}, - // }, - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.HTTPRetryPolicyRetryBackOff{ - // InitialDelayInMilliseconds: to.Ptr[int64](1000), - // MaxIntervalInMilliseconds: to.Ptr[int64](10000), - // }, - // }, - // TCPConnectionPool: &armappcontainers.TCPConnectionPool{ - // MaxConnections: to.Ptr[int32](100), - // }, - // TCPRetryPolicy: &armappcontainers.TCPRetryPolicy{ - // MaxConnectAttempts: to.Ptr[int32](3), - // }, - // TimeoutPolicy: &armappcontainers.TimeoutPolicy{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](40), - // ResponseTimeoutInSeconds: to.Ptr[int32](30), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Delete.json -func ExampleAppResiliencyClient_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.NewAppResiliencyClient().Delete(ctx, "rg", "testcontainerApp0", "resiliency-policy-1", 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Get.json -func ExampleAppResiliencyClient_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.NewAppResiliencyClient().Get(ctx, "rg", "testcontainerApp0", "resiliency-policy-1", 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.AppResiliency = armappcontainers.AppResiliency{ - // Name: to.Ptr("resiliency-policy-1"), - // Type: to.Ptr("Microsoft.App/containerApps/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0/resiliencyPolicies/resiliency-policy-1"), - // Properties: &armappcontainers.AppResiliencyProperties{ - // CircuitBreakerPolicy: &armappcontainers.CircuitBreakerPolicy{ - // ConsecutiveErrors: to.Ptr[int32](5), - // IntervalInSeconds: to.Ptr[int32](10), - // MaxEjectionPercent: to.Ptr[int32](50), - // }, - // HTTPConnectionPool: &armappcontainers.HTTPConnectionPool{ - // HTTP1MaxPendingRequests: to.Ptr[int32](1024), - // HTTP2MaxRequests: to.Ptr[int32](1024), - // }, - // HTTPRetryPolicy: &armappcontainers.HTTPRetryPolicy{ - // Matches: &armappcontainers.HTTPRetryPolicyMatches{ - // Errors: []*string{ - // to.Ptr("5xx"), - // to.Ptr("connect-failure"), - // to.Ptr("reset"), - // to.Ptr("retriable-headers"), - // to.Ptr("retriable-status-codes")}, - // Headers: []*armappcontainers.HeaderMatch{ - // { - // Header: to.Ptr("X-Content-Type"), - // Match: &armappcontainers.HeaderMatchMatch{ - // PrefixMatch: to.Ptr("GOATS"), - // }, - // }}, - // HTTPStatusCodes: []*int32{ - // to.Ptr[int32](502), - // to.Ptr[int32](503)}, - // }, - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.HTTPRetryPolicyRetryBackOff{ - // InitialDelayInMilliseconds: to.Ptr[int64](1000), - // MaxIntervalInMilliseconds: to.Ptr[int64](10000), - // }, - // }, - // TCPConnectionPool: &armappcontainers.TCPConnectionPool{ - // MaxConnections: to.Ptr[int32](100), - // }, - // TCPRetryPolicy: &armappcontainers.TCPRetryPolicy{ - // MaxConnectAttempts: to.Ptr[int32](3), - // }, - // TimeoutPolicy: &armappcontainers.TimeoutPolicy{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](5), - // ResponseTimeoutInSeconds: to.Ptr[int32](15), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_List.json -func ExampleAppResiliencyClient_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.NewAppResiliencyClient().NewListPager("rg", "testcontainerApp0", 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.AppResiliencyCollection = armappcontainers.AppResiliencyCollection{ - // Value: []*armappcontainers.AppResiliency{ - // { - // Name: to.Ptr("resiliency-policy-1"), - // Type: to.Ptr("Microsoft.App/containerApps/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0/resiliencyPolicies/resiliency-policy-1"), - // Properties: &armappcontainers.AppResiliencyProperties{ - // CircuitBreakerPolicy: &armappcontainers.CircuitBreakerPolicy{ - // ConsecutiveErrors: to.Ptr[int32](5), - // IntervalInSeconds: to.Ptr[int32](10), - // MaxEjectionPercent: to.Ptr[int32](50), - // }, - // HTTPConnectionPool: &armappcontainers.HTTPConnectionPool{ - // HTTP1MaxPendingRequests: to.Ptr[int32](1024), - // HTTP2MaxRequests: to.Ptr[int32](1024), - // }, - // HTTPRetryPolicy: &armappcontainers.HTTPRetryPolicy{ - // Matches: &armappcontainers.HTTPRetryPolicyMatches{ - // Errors: []*string{ - // to.Ptr("5xx"), - // to.Ptr("connect-failure"), - // to.Ptr("reset"), - // to.Ptr("retriable-headers"), - // to.Ptr("retriable-status-codes")}, - // Headers: []*armappcontainers.HeaderMatch{ - // { - // Header: to.Ptr("X-Content-Type"), - // Match: &armappcontainers.HeaderMatchMatch{ - // PrefixMatch: to.Ptr("GOATS"), - // }, - // }}, - // HTTPStatusCodes: []*int32{ - // to.Ptr[int32](502), - // to.Ptr[int32](503)}, - // }, - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.HTTPRetryPolicyRetryBackOff{ - // InitialDelayInMilliseconds: to.Ptr[int64](1000), - // MaxIntervalInMilliseconds: to.Ptr[int64](10000), - // }, - // }, - // TCPConnectionPool: &armappcontainers.TCPConnectionPool{ - // MaxConnections: to.Ptr[int32](100), - // }, - // TCPRetryPolicy: &armappcontainers.TCPRetryPolicy{ - // MaxConnectAttempts: to.Ptr[int32](3), - // }, - // TimeoutPolicy: &armappcontainers.TimeoutPolicy{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](5), - // ResponseTimeoutInSeconds: to.Ptr[int32](15), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md b/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md index e5f077e81bc5..1636466636be 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md +++ b/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/app/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/app/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 3.1.0-beta.1 -tag: package-preview-2024-08 +module-version: 3.1.0-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go index f002bb1c0aae..a3dec14b493b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -46,7 +45,7 @@ func NewAvailableWorkloadProfilesClient(subscriptionID string, credential azcore // NewGetPager - Get all available workload profiles for a location. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - location - The name of Azure region. // - options - AvailableWorkloadProfilesClientGetOptions contains the optional parameters for the AvailableWorkloadProfilesClient.NewGetPager // method. @@ -89,7 +88,7 @@ func (client *AvailableWorkloadProfilesClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go deleted file mode 100644 index 36dbfbea0124..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go +++ /dev/null @@ -1,190 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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("NC48-A100"), - // Type: to.Ptr("Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.App/availableManagedEnvironmentsWorkloadProfileTypes/NC48-A100"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.AvailableWorkloadProfileProperties{ - // Applicability: to.Ptr(armappcontainers.ApplicabilityCustom), - // Category: to.Ptr("GPU-NC-A100"), - // Cores: to.Ptr[int32](48), - // DisplayName: to.Ptr("Dedicated-NC48-A100"), - // Gpus: to.Ptr[int32](2), - // MemoryGiB: to.Ptr[int32](440), - // }, - // }, - // { - // 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 index fb9d5607d509..ae123e60d5a6 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -47,7 +46,7 @@ func NewBillingMetersClient(subscriptionID string, credential azcore.TokenCreden // Get - Get all billingMeters for a location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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) { @@ -88,7 +87,7 @@ func (client *BillingMetersClient) getCreateRequest(ctx context.Context, locatio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go deleted file mode 100644 index 7b05697674eb..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go +++ /dev/null @@ -1,107 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/buildauthtoken_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client.go index eb4ff1488841..8536c079bdb1 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // BuildAuthTokenClient contains the methods for the BuildAuthToken group. @@ -47,7 +46,7 @@ func NewBuildAuthTokenClient(subscriptionID string, credential azcore.TokenCrede // List - Gets the token used to connect to the endpoint where source code can be uploaded for a build. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - buildName - The name of a build. @@ -98,7 +97,7 @@ func (client *BuildAuthTokenClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client_example_test.go deleted file mode 100644 index 4c00de57afe3..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client_example_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_ListAuthToken.json -func ExampleBuildAuthTokenClient_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.NewBuildAuthTokenClient().List(ctx, "rg", "testBuilder", "testBuild", 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.BuildToken = armappcontainers.BuildToken{ - // Expires: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-14T19:22:50.308Z"); return t}()), - // Token: to.Ptr("foobartoken"), - // } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/builders_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/builders_client.go index 123a83291c3a..1beb5b6f6a45 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/builders_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/builders_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // BuildersClient contains the methods for the Builders group. @@ -47,7 +46,7 @@ func NewBuildersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create or update a BuilderResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - builderEnvelope - Resource create parameters. @@ -74,7 +73,7 @@ func (client *BuildersClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update a BuilderResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *BuildersClient) createOrUpdate(ctx context.Context, resourceGroupName string, builderName string, builderEnvelope BuilderResource, options *BuildersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "BuildersClient.BeginCreateOrUpdate" @@ -116,7 +115,7 @@ func (client *BuildersClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, builderEnvelope); err != nil { @@ -128,7 +127,7 @@ func (client *BuildersClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete a BuilderResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - options - BuildersClientBeginDeleteOptions contains the optional parameters for the BuildersClient.BeginDelete method. @@ -153,7 +152,7 @@ func (client *BuildersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a BuilderResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *BuildersClient) deleteOperation(ctx context.Context, resourceGroupName string, builderName string, options *BuildersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "BuildersClient.BeginDelete" @@ -195,7 +194,7 @@ func (client *BuildersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +203,7 @@ func (client *BuildersClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a BuilderResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - options - BuildersClientGetOptions contains the optional parameters for the BuildersClient.Get method. @@ -250,7 +249,7 @@ func (client *BuildersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +266,7 @@ func (client *BuildersClient) getHandleResponse(resp *http.Response) (BuildersCl // NewListByResourceGroupPager - List BuilderResource resources by resource group // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - BuildersClientListByResourceGroupOptions contains the optional parameters for the BuildersClient.NewListByResourceGroupPager // method. @@ -310,7 +309,7 @@ func (client *BuildersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,7 +326,7 @@ func (client *BuildersClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - List BuilderResource resources by subscription ID // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - options - BuildersClientListBySubscriptionOptions contains the optional parameters for the BuildersClient.NewListBySubscriptionPager // method. func (client *BuildersClient) NewListBySubscriptionPager(options *BuildersClientListBySubscriptionOptions) *runtime.Pager[BuildersClientListBySubscriptionResponse] { @@ -365,7 +364,7 @@ func (client *BuildersClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -383,7 +382,7 @@ func (client *BuildersClient) listBySubscriptionHandleResponse(resp *http.Respon // BeginUpdate - Update a BuilderResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - builderEnvelope - The resource properties to be updated. @@ -409,7 +408,7 @@ func (client *BuildersClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update a BuilderResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *BuildersClient) update(ctx context.Context, resourceGroupName string, builderName string, builderEnvelope BuilderResourceUpdate, options *BuildersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "BuildersClient.BeginUpdate" @@ -451,7 +450,7 @@ func (client *BuildersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, builderEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/builders_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/builders_client_example_test.go deleted file mode 100644 index 4180c97a7d54..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/builders_client_example_test.go +++ /dev/null @@ -1,478 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_ListBySubscription.json -func ExampleBuildersClient_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.NewBuildersClient().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.BuilderCollection = armappcontainers.BuilderCollection{ - // Value: []*armappcontainers.BuilderResource{ - // { - // Name: to.Ptr("testBuilder1"), - // Type: to.Ptr("Microsoft.App/builders"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.App/builders/testBuilder1"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armappcontainers.BuilderProperties{ - // ContainerRegistries: []*armappcontainers.ContainerRegistry{ - // { - // ContainerRegistryServer: to.Ptr("test.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }, - // { - // ContainerRegistryServer: to.Ptr("test2.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }}, - // EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv"), - // ProvisioningState: to.Ptr(armappcontainers.BuilderProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("testBuilder2"), - // Type: to.Ptr("Microsoft.App/builders"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg2/providers/Microsoft.App/builders/testBuilder2"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armappcontainers.BuilderProperties{ - // ContainerRegistries: []*armappcontainers.ContainerRegistry{ - // { - // ContainerRegistryServer: to.Ptr("test.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }, - // { - // ContainerRegistryServer: to.Ptr("test2.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }}, - // EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv"), - // ProvisioningState: to.Ptr(armappcontainers.BuilderProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_ListByResourceGroup.json -func ExampleBuildersClient_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.NewBuildersClient().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.BuilderCollection = armappcontainers.BuilderCollection{ - // Value: []*armappcontainers.BuilderResource{ - // { - // Name: to.Ptr("testBuilder1"), - // Type: to.Ptr("Microsoft.App/builders"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder1"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armappcontainers.BuilderProperties{ - // ContainerRegistries: []*armappcontainers.ContainerRegistry{ - // { - // ContainerRegistryServer: to.Ptr("test.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }, - // { - // ContainerRegistryServer: to.Ptr("test2.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }}, - // EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv"), - // ProvisioningState: to.Ptr(armappcontainers.BuilderProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("testBuilder2"), - // Type: to.Ptr("Microsoft.App/builders"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder2"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armappcontainers.BuilderProperties{ - // ContainerRegistries: []*armappcontainers.ContainerRegistry{ - // { - // ContainerRegistryServer: to.Ptr("test.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }, - // { - // ContainerRegistryServer: to.Ptr("test2.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }}, - // EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv"), - // ProvisioningState: to.Ptr(armappcontainers.BuilderProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Get.json -func ExampleBuildersClient_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.NewBuildersClient().Get(ctx, "rg", "testBuilder", 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.BuilderResource = armappcontainers.BuilderResource{ - // Name: to.Ptr("testBuilder"), - // Type: to.Ptr("Microsoft.App/builders"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armappcontainers.BuilderProperties{ - // ContainerRegistries: []*armappcontainers.ContainerRegistry{ - // { - // ContainerRegistryServer: to.Ptr("test.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }, - // { - // ContainerRegistryServer: to.Ptr("test2.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }}, - // EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv"), - // ProvisioningState: to.Ptr(armappcontainers.BuilderProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_CreateOrUpdate.json -func ExampleBuildersClient_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.NewBuildersClient().BeginCreateOrUpdate(ctx, "rg", "testBuilder", armappcontainers.BuilderResource{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "company": to.Ptr("Microsoft"), - }, - Identity: &armappcontainers.ManagedServiceIdentity{ - Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {}, - }, - }, - Properties: &armappcontainers.BuilderProperties{ - ContainerRegistries: []*armappcontainers.ContainerRegistry{ - { - ContainerRegistryServer: to.Ptr("test.azurecr.io"), - IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - }, - { - ContainerRegistryServer: to.Ptr("test2.azurecr.io"), - IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - }}, - EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv"), - }, - }, 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.BuilderResource = armappcontainers.BuilderResource{ - // Name: to.Ptr("testBuilder"), - // Type: to.Ptr("Microsoft.App/builders"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "company": to.Ptr("Microsoft"), - // }, - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armappcontainers.BuilderProperties{ - // ContainerRegistries: []*armappcontainers.ContainerRegistry{ - // { - // ContainerRegistryServer: to.Ptr("test.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }, - // { - // ContainerRegistryServer: to.Ptr("test2.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }}, - // EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv"), - // ProvisioningState: to.Ptr(armappcontainers.BuilderProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Update.json -func ExampleBuildersClient_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.NewBuildersClient().BeginUpdate(ctx, "rg", "testBuilder", armappcontainers.BuilderResourceUpdate{ - Tags: map[string]*string{ - "mytag1": to.Ptr("myvalue1"), - }, - }, 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.BuilderResource = armappcontainers.BuilderResource{ - // Name: to.Ptr("testBuilder"), - // Type: to.Ptr("Microsoft.App/builders"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "mytag1": to.Ptr("myvalue1"), - // }, - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armappcontainers.BuilderProperties{ - // ContainerRegistries: []*armappcontainers.ContainerRegistry{ - // { - // ContainerRegistryServer: to.Ptr("test.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }, - // { - // ContainerRegistryServer: to.Ptr("test2.azurecr.io"), - // IdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1"), - // }}, - // EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv"), - // ProvisioningState: to.Ptr(armappcontainers.BuilderProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Delete.json -func ExampleBuildersClient_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.NewBuildersClient().BeginDelete(ctx, "rg", "testBuilder", 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) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/builds_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/builds_client.go index 0464c3c4e352..85c21c8e8a2b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/builds_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/builds_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // BuildsClient contains the methods for the Builds group. @@ -47,7 +46,7 @@ func NewBuildsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Create a BuildResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - buildName - The name of a build. @@ -75,7 +74,7 @@ func (client *BuildsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Create a BuildResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *BuildsClient) createOrUpdate(ctx context.Context, resourceGroupName string, builderName string, buildName string, buildEnvelope BuildResource, options *BuildsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "BuildsClient.BeginCreateOrUpdate" @@ -121,7 +120,7 @@ func (client *BuildsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, buildEnvelope); err != nil { @@ -133,7 +132,7 @@ func (client *BuildsClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Delete a BuildResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - buildName - The name of a build. @@ -159,7 +158,7 @@ func (client *BuildsClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Delete a BuildResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *BuildsClient) deleteOperation(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *BuildsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "BuildsClient.BeginDelete" @@ -205,7 +204,7 @@ func (client *BuildsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +213,7 @@ func (client *BuildsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Get a BuildResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - buildName - The name of a build. @@ -265,7 +264,7 @@ func (client *BuildsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/builds_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/builds_client_example_test.go deleted file mode 100644 index 5ee64a7fe013..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/builds_client_example_test.go +++ /dev/null @@ -1,303 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_Get.json -func ExampleBuildsClient_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.NewBuildsClient().Get(ctx, "rg", "testBuilder", "testBuild", 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.BuildResource = armappcontainers.BuildResource{ - // Name: to.Ptr("testBuild"), - // Type: to.Ptr("Microsoft.App/builders/builds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder/builds/testBuild"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Properties: &armappcontainers.BuildProperties{ - // BuildStatus: to.Ptr(armappcontainers.BuildStatusInProgress), - // Configuration: &armappcontainers.BuildConfiguration{ - // BaseOs: to.Ptr("DebianBullseye"), - // EnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // Platform: to.Ptr("dotnetcore"), - // PlatformVersion: to.Ptr("7.0"), - // PreBuildSteps: []*armappcontainers.PreBuildStep{ - // { - // Description: to.Ptr("First pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'world'")}, - // }, - // { - // Description: to.Ptr("Second pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'again'")}, - // }}, - // }, - // DestinationContainerRegistry: &armappcontainers.ContainerRegistryWithCustomImage{ - // Image: to.Ptr("test.azurecr.io/repo:tag"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // LogStreamEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/logstream"), - // ProvisioningState: to.Ptr(armappcontainers.BuildProvisioningStateSucceeded), - // TokenEndpoint: to.Ptr("https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{rg-id}/Microsoft.App/builders/testBuilder/builds/testBuild/listAuthToken"), - // UploadEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/upload"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_CreateOrUpdate_NoConfig.json -func ExampleBuildsClient_BeginCreateOrUpdate_buildsCreateOrUpdateNoConfig() { - 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.NewBuildsClient().BeginCreateOrUpdate(ctx, "rg", "testBuilder", "testBuild", armappcontainers.BuildResource{}, 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.BuildResource = armappcontainers.BuildResource{ - // Name: to.Ptr("testBuild"), - // Type: to.Ptr("Microsoft.App/builders/builds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder/builds/testBuild"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Properties: &armappcontainers.BuildProperties{ - // BuildStatus: to.Ptr(armappcontainers.BuildStatusInProgress), - // LogStreamEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/logstream"), - // ProvisioningState: to.Ptr(armappcontainers.BuildProvisioningStateSucceeded), - // TokenEndpoint: to.Ptr("https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{rg-id}/Microsoft.App/builders/testBuilder/builds/testBuild/listAuthToken"), - // UploadEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/upload"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_CreateOrUpdate.json -func ExampleBuildsClient_BeginCreateOrUpdate_buildsCreateOrUpdateWithConfig() { - 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.NewBuildsClient().BeginCreateOrUpdate(ctx, "rg", "testBuilder", "testBuild-123456789az", armappcontainers.BuildResource{ - Properties: &armappcontainers.BuildProperties{ - Configuration: &armappcontainers.BuildConfiguration{ - BaseOs: to.Ptr("DebianBullseye"), - EnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - { - Name: to.Ptr("foo1"), - Value: to.Ptr("bar1"), - }, - { - Name: to.Ptr("foo2"), - Value: to.Ptr("bar2"), - }}, - Platform: to.Ptr("dotnetcore"), - PlatformVersion: to.Ptr("7.0"), - PreBuildSteps: []*armappcontainers.PreBuildStep{ - { - Description: to.Ptr("First pre build step."), - HTTPGet: &armappcontainers.HTTPGet{ - FileName: to.Ptr("output.txt"), - Headers: []*string{ - to.Ptr("foo"), - to.Ptr("bar")}, - URL: to.Ptr("https://microsoft.com"), - }, - Scripts: []*string{ - to.Ptr("echo 'hello'"), - to.Ptr("echo 'world'")}, - }, - { - Description: to.Ptr("Second pre build step."), - HTTPGet: &armappcontainers.HTTPGet{ - FileName: to.Ptr("output.txt"), - Headers: []*string{ - to.Ptr("foo")}, - URL: to.Ptr("https://microsoft.com"), - }, - Scripts: []*string{ - to.Ptr("echo 'hello'"), - to.Ptr("echo 'again'")}, - }}, - }, - DestinationContainerRegistry: &armappcontainers.ContainerRegistryWithCustomImage{ - Image: to.Ptr("test.azurecr.io/repo:tag"), - Server: to.Ptr("test.azurecr.io"), - }, - }, - }, 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.BuildResource = armappcontainers.BuildResource{ - // Name: to.Ptr("testBuild-123456789az"), - // Type: to.Ptr("Microsoft.App/builders/builds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder/builds/testBuild-123456789az"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Properties: &armappcontainers.BuildProperties{ - // BuildStatus: to.Ptr(armappcontainers.BuildStatusInProgress), - // Configuration: &armappcontainers.BuildConfiguration{ - // BaseOs: to.Ptr("DebianBullseye"), - // EnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // Platform: to.Ptr("dotnetcore"), - // PlatformVersion: to.Ptr("7.0"), - // PreBuildSteps: []*armappcontainers.PreBuildStep{ - // { - // Description: to.Ptr("First pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'world'")}, - // }, - // { - // Description: to.Ptr("Second pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'again'")}, - // }}, - // }, - // DestinationContainerRegistry: &armappcontainers.ContainerRegistryWithCustomImage{ - // Image: to.Ptr("test.azurecr.io/repo:tag"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // LogStreamEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/logstream"), - // ProvisioningState: to.Ptr(armappcontainers.BuildProvisioningStateSucceeded), - // TokenEndpoint: to.Ptr("https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{rg-id}/Microsoft.App/builders/testBuilder/builds/testBuild/listAuthToken"), - // UploadEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/upload"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_Delete.json -func ExampleBuildsClient_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.NewBuildsClient().BeginDelete(ctx, "rg", "testBuilder", "testBuild", 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) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client.go index c92bd55b84b4..6d13d8ad5a53 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // BuildsByBuilderResourceClient contains the methods for the BuildsByBuilderResource group. @@ -46,7 +45,7 @@ func NewBuildsByBuilderResourceClient(subscriptionID string, credential azcore.T // NewListPager - List BuildResource resources by BuilderResource // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - builderName - The name of the builder. // - options - BuildsByBuilderResourceClientListOptions contains the optional parameters for the BuildsByBuilderResourceClient.NewListPager @@ -94,7 +93,7 @@ func (client *BuildsByBuilderResourceClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client_example_test.go deleted file mode 100644 index 0d72d74d91fa..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client_example_test.go +++ /dev/null @@ -1,174 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_ListByBuilderResource.json -func ExampleBuildsByBuilderResourceClient_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.NewBuildsByBuilderResourceClient().NewListPager("rg", "testBuilder", 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.BuildCollection = armappcontainers.BuildCollection{ - // Value: []*armappcontainers.BuildResource{ - // { - // Name: to.Ptr("testBuild1"), - // Type: to.Ptr("Microsoft.App/builders/builds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder/builds/testBuild1"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Properties: &armappcontainers.BuildProperties{ - // BuildStatus: to.Ptr(armappcontainers.BuildStatusInProgress), - // Configuration: &armappcontainers.BuildConfiguration{ - // BaseOs: to.Ptr("DebianBullseye"), - // EnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // Platform: to.Ptr("dotnetcore"), - // PlatformVersion: to.Ptr("7.0"), - // PreBuildSteps: []*armappcontainers.PreBuildStep{ - // { - // Description: to.Ptr("First pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'world'")}, - // }, - // { - // Description: to.Ptr("Second pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'again'")}, - // }}, - // }, - // DestinationContainerRegistry: &armappcontainers.ContainerRegistryWithCustomImage{ - // Image: to.Ptr("test.azurecr.io/repo:tag"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // LogStreamEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/logstream"), - // ProvisioningState: to.Ptr(armappcontainers.BuildProvisioningStateSucceeded), - // TokenEndpoint: to.Ptr("https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{rg-id}/Microsoft.App/builders/testBuilder/builds/testBuild/listAuthToken"), - // UploadEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/upload"), - // }, - // }, - // { - // Name: to.Ptr("testBuild2"), - // Type: to.Ptr("Microsoft.App/builders/builds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/builders/testBuilder/builds/testBuild2"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Properties: &armappcontainers.BuildProperties{ - // BuildStatus: to.Ptr(armappcontainers.BuildStatusInProgress), - // Configuration: &armappcontainers.BuildConfiguration{ - // BaseOs: to.Ptr("DebianBullseye"), - // EnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // Platform: to.Ptr("dotnetcore"), - // PlatformVersion: to.Ptr("7.0"), - // PreBuildSteps: []*armappcontainers.PreBuildStep{ - // { - // Description: to.Ptr("First pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'world'")}, - // }, - // { - // Description: to.Ptr("Second pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'again'")}, - // }}, - // }, - // DestinationContainerRegistry: &armappcontainers.ContainerRegistryWithCustomImage{ - // Image: to.Ptr("test.azurecr.io/repo:tag"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // LogStreamEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/logstream"), - // ProvisioningState: to.Ptr(armappcontainers.BuildProvisioningStateSucceeded), - // TokenEndpoint: to.Ptr("https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{rg-id}/Microsoft.App/builders/testBuilder/builds/testBuild/listAuthToken"), - // UploadEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/upload"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go index 6e6166666102..492c1c28f1f2 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // CertificatesClient contains the methods for the Certificates group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - certificateName - Name of the Certificate. @@ -99,7 +98,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.CertificateEnvelope != nil { @@ -123,7 +122,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - certificateName - Name of the Certificate. @@ -173,7 +172,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +181,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - certificateName - Name of the Certificate. @@ -233,7 +232,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +249,7 @@ func (client *CertificatesClient) getHandleResponse(resp *http.Response) (Certif // NewListPager - Get the Certificates in a given managed environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -297,7 +296,7 @@ func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -315,7 +314,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - certificateName - Name of the Certificate. @@ -367,7 +366,7 @@ func (client *CertificatesClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, certificateEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go deleted file mode 100644 index e7271d320c35..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go +++ /dev/null @@ -1,280 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_ListByManagedEnvironment.json -func ExampleCertificatesClient_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.NewCertificatesClient().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/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.CertificateProperties{ - // CertificateType: to.Ptr(armappcontainers.CertificateTypeImagePullTrustedCA), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.CertificateProperties{ - // CertificateType: to.Ptr(armappcontainers.CertificateTypeServerSSLCertificate), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_Get.json -func ExampleCertificatesClient_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.NewCertificatesClient().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/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.CertificateProperties{ - // CertificateType: to.Ptr(armappcontainers.CertificateTypeServerSSLCertificate), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_CreateOrUpdate.json -func ExampleCertificatesClient_CreateOrUpdate_createOrUpdateCertificate() { - 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.NewCertificatesClient().CreateOrUpdate(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", &armappcontainers.CertificatesClientCreateOrUpdateOptions{CertificateEnvelope: &armappcontainers.Certificate{ - Location: to.Ptr("East US"), - Properties: &armappcontainers.CertificateProperties{ - CertificateType: to.Ptr(armappcontainers.CertificateTypeImagePullTrustedCA), - 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/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.CertificateProperties{ - // CertificateType: to.Ptr(armappcontainers.CertificateTypeImagePullTrustedCA), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_CreateOrUpdate_FromKeyVault.json -func ExampleCertificatesClient_CreateOrUpdate_createOrUpdateCertificateUsingManagedIdentity() { - 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.NewCertificatesClient().CreateOrUpdate(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", &armappcontainers.CertificatesClientCreateOrUpdateOptions{CertificateEnvelope: &armappcontainers.Certificate{ - Location: to.Ptr("East US"), - Properties: &armappcontainers.CertificateProperties{ - CertificateKeyVaultProperties: &armappcontainers.CertificateKeyVaultProperties{ - Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/microsoft.managedidentity/userassignedidentities/test-user-mi"), - KeyVaultURL: to.Ptr("https://xxxxxxxx.vault.azure.net/certificates/certName"), - }, - CertificateType: to.Ptr(armappcontainers.CertificateTypeServerSSLCertificate), - }, - }, - }) - 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/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.CertificateProperties{ - // CertificateKeyVaultProperties: &armappcontainers.CertificateKeyVaultProperties{ - // Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/microsoft.managedidentity/userassignedidentities/test-user-mi"), - // KeyVaultURL: to.Ptr("https://xxxxxxxx.vault.azure.net/certificates/certName"), - // }, - // CertificateType: to.Ptr(armappcontainers.CertificateTypeServerSSLCertificate), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_Delete.json -func ExampleCertificatesClient_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.NewCertificatesClient().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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_Patch.json -func ExampleCertificatesClient_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.NewCertificatesClient().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/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-firendly-name"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armappcontainers.CertificateProperties{ - // CertificateType: to.Ptr(armappcontainers.CertificateTypeServerSSLCertificate), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/client_factory.go b/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go index b7ffd5d49e3e..b33e0d3bba3d 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go @@ -180,6 +180,14 @@ func (c *ClientFactory) NewContainerAppsDiagnosticsClient() *ContainerAppsDiagno } } +// NewContainerAppsLabelHistoryClient creates a new instance of ContainerAppsLabelHistoryClient. +func (c *ClientFactory) NewContainerAppsLabelHistoryClient() *ContainerAppsLabelHistoryClient { + return &ContainerAppsLabelHistoryClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewContainerAppsPatchesClient creates a new instance of ContainerAppsPatchesClient. func (c *ClientFactory) NewContainerAppsPatchesClient() *ContainerAppsPatchesClient { return &ContainerAppsPatchesClient{ @@ -260,6 +268,14 @@ func (c *ClientFactory) NewFunctionsExtensionClient() *FunctionsExtensionClient } } +// NewHTTPRouteConfigClient creates a new instance of HTTPRouteConfigClient. +func (c *ClientFactory) NewHTTPRouteConfigClient() *HTTPRouteConfigClient { + return &HTTPRouteConfigClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewJavaComponentsClient creates a new instance of JavaComponentsClient. func (c *ClientFactory) NewJavaComponentsClient() *JavaComponentsClient { return &JavaComponentsClient{ @@ -292,6 +308,14 @@ func (c *ClientFactory) NewLogicAppsClient() *LogicAppsClient { } } +// NewMaintenanceConfigurationsClient creates a new instance of MaintenanceConfigurationsClient. +func (c *ClientFactory) NewMaintenanceConfigurationsClient() *MaintenanceConfigurationsClient { + return &MaintenanceConfigurationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewManagedCertificatesClient creates a new instance of ManagedCertificatesClient. func (c *ClientFactory) NewManagedCertificatesClient() *ManagedCertificatesClient { return &ManagedCertificatesClient{ diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go index 70a8823f70f0..dc937e6cf88a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -47,7 +46,7 @@ func NewConnectedEnvironmentsClient(subscriptionID string, credential azcore.Tok // CheckNameAvailability - Checks if resource connectedEnvironmentName is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -95,7 +94,7 @@ func (client *ConnectedEnvironmentsClient) checkNameAvailabilityCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, checkNameAvailabilityRequest); err != nil { @@ -116,7 +115,7 @@ func (client *ConnectedEnvironmentsClient) checkNameAvailabilityHandleResponse(r // BeginCreateOrUpdate - Creates or updates an connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - connectedEnvironmentName - Name of the connectedEnvironment. // - environmentEnvelope - Configuration details of the connectedEnvironment. @@ -143,7 +142,7 @@ func (client *ConnectedEnvironmentsClient) BeginCreateOrUpdate(ctx context.Conte // CreateOrUpdate - Creates or updates an connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ConnectedEnvironmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, environmentEnvelope ConnectedEnvironment, options *ConnectedEnvironmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ConnectedEnvironmentsClient.BeginCreateOrUpdate" @@ -185,7 +184,7 @@ func (client *ConnectedEnvironmentsClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, environmentEnvelope); err != nil { @@ -197,7 +196,7 @@ func (client *ConnectedEnvironmentsClient) createOrUpdateCreateRequest(ctx conte // BeginDelete - Delete an connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -223,7 +222,7 @@ func (client *ConnectedEnvironmentsClient) BeginDelete(ctx context.Context, reso // Delete - Delete an connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ConnectedEnvironmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ConnectedEnvironmentsClient.BeginDelete" @@ -265,7 +264,7 @@ func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -274,7 +273,7 @@ func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Conte // Get - Get the properties of an connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -321,7 +320,7 @@ func (client *ConnectedEnvironmentsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -338,7 +337,7 @@ func (client *ConnectedEnvironmentsClient) getHandleResponse(resp *http.Response // NewListByResourceGroupPager - Get all connectedEnvironments in a resource group. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ConnectedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ConnectedEnvironmentsClient.NewListByResourceGroupPager // method. @@ -381,7 +380,7 @@ func (client *ConnectedEnvironmentsClient) listByResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -398,7 +397,7 @@ func (client *ConnectedEnvironmentsClient) listByResourceGroupHandleResponse(res // NewListBySubscriptionPager - Get all connectedEnvironments for a subscription. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - options - ConnectedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ConnectedEnvironmentsClient.NewListBySubscriptionPager // method. func (client *ConnectedEnvironmentsClient) NewListBySubscriptionPager(options *ConnectedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ConnectedEnvironmentsClientListBySubscriptionResponse] { @@ -436,7 +435,7 @@ func (client *ConnectedEnvironmentsClient) listBySubscriptionCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -454,7 +453,7 @@ func (client *ConnectedEnvironmentsClient) listBySubscriptionHandleResponse(resp // 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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -501,7 +500,7 @@ func (client *ConnectedEnvironmentsClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go deleted file mode 100644 index 55f04b1cb894..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go +++ /dev/null @@ -1,357 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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:00.000Z"); 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:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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:00.000Z"); 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:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/connectedEnvironments"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/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:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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 index 14710f66f671..d5a4af0fb38b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -44,39 +43,60 @@ func NewConnectedEnvironmentsCertificatesClient(subscriptionID string, credentia return client, nil } -// CreateOrUpdate - Create or Update a Certificate. +// BeginCreateOrUpdate - Create or Update a Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 +// - options - ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.BeginCreateOrUpdate // method. -func (client *ConnectedEnvironmentsCertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions) (ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse, error) { +func (client *ConnectedEnvironmentsCertificatesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or Update a Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error - const operationName = "ConnectedEnvironmentsCertificatesClient.CreateOrUpdate" + const operationName = "ConnectedEnvironmentsCertificatesClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) if err != nil { - return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) - return ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse{}, err + return nil, err } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions) (*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") @@ -99,7 +119,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.CertificateEnvelope != nil { @@ -111,47 +131,60 @@ func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateCreateReque 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. +// BeginDelete - Deletes the specified Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 +// - options - ConnectedEnvironmentsCertificatesClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.BeginDelete // method. -func (client *ConnectedEnvironmentsCertificatesClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientDeleteOptions) (ConnectedEnvironmentsCertificatesClientDeleteResponse, error) { +func (client *ConnectedEnvironmentsCertificatesClient) BeginDelete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientBeginDeleteOptions) (*runtime.Poller[ConnectedEnvironmentsCertificatesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsCertificatesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConnectedEnvironmentsCertificatesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified Certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +func (client *ConnectedEnvironmentsCertificatesClient) deleteOperation(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "ConnectedEnvironmentsCertificatesClient.Delete" + const operationName = "ConnectedEnvironmentsCertificatesClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, options) if err != nil { - return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) - return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, err + return nil, err } - return ConnectedEnvironmentsCertificatesClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *ConnectedEnvironmentsCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientDeleteOptions) (*policy.Request, error) { +func (client *ConnectedEnvironmentsCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *ConnectedEnvironmentsCertificatesClientBeginDeleteOptions) (*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") @@ -174,7 +207,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) deleteCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -183,7 +216,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) deleteCreateRequest(ctx c // Get - Get the specified Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - connectedEnvironmentName - Name of the Connected Environment. // - certificateName - Name of the Certificate. @@ -235,7 +268,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +285,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) getHandleResponse(resp *h // NewListPager - Get the Certificates in a given connected environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -300,7 +333,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) listCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -315,40 +348,61 @@ func (client *ConnectedEnvironmentsCertificatesClient) listHandleResponse(resp * return result, nil } -// Update - Patches a certificate. Currently only patching of tags is supported +// BeginUpdate - Patches a certificate. Currently only patching of tags is supported // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 +// - options - ConnectedEnvironmentsCertificatesClientBeginUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.BeginUpdate // method. -func (client *ConnectedEnvironmentsCertificatesClient) Update(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope CertificatePatch, options *ConnectedEnvironmentsCertificatesClientUpdateOptions) (ConnectedEnvironmentsCertificatesClientUpdateResponse, error) { +func (client *ConnectedEnvironmentsCertificatesClient) BeginUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope CertificatePatch, options *ConnectedEnvironmentsCertificatesClientBeginUpdateOptions) (*runtime.Poller[ConnectedEnvironmentsCertificatesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, connectedEnvironmentName, certificateName, certificateEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsCertificatesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConnectedEnvironmentsCertificatesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2024-10-02-preview +func (client *ConnectedEnvironmentsCertificatesClient) update(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope CertificatePatch, options *ConnectedEnvironmentsCertificatesClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "ConnectedEnvironmentsCertificatesClient.Update" + const operationName = "ConnectedEnvironmentsCertificatesClient.BeginUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, certificateName, certificateEnvelope, options) if err != nil { - return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) - return ConnectedEnvironmentsCertificatesClientUpdateResponse{}, err + return nil, err } - resp, err := client.updateHandleResponse(httpResp) - return resp, err + return httpResp, nil } // 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) { +func (client *ConnectedEnvironmentsCertificatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope CertificatePatch, options *ConnectedEnvironmentsCertificatesClientBeginUpdateOptions) (*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") @@ -371,7 +425,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) updateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, certificateEnvelope); err != nil { @@ -379,12 +433,3 @@ func (client *ConnectedEnvironmentsCertificatesClient) updateCreateRequest(ctx c } return req, nil } - -// 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 deleted file mode 100644 index 295aa2494e4e..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client_example_test.go +++ /dev/null @@ -1,223 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/certificates/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:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/certificates/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:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/certificates/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:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/certififcates/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:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/certificates/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:00.000Z"); return t}()), - // IssueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-06T04:00:00.000Z"); 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 index 85be72498081..50c720877b61 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -44,40 +43,61 @@ func NewConnectedEnvironmentsDaprComponentsClient(subscriptionID string, credent return client, nil } -// CreateOrUpdate - Creates or updates a Dapr Component in a connected environment. +// BeginCreateOrUpdate - Creates or updates a Dapr Component in a connected environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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) { +// - options - ConnectedEnvironmentsDaprComponentsClientBeginCreateOrUpdateOptions contains the optional parameters for the +// ConnectedEnvironmentsDaprComponentsClient.BeginCreateOrUpdate method. +func (client *ConnectedEnvironmentsDaprComponentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope ConnectedEnvironmentDaprComponent, options *ConnectedEnvironmentsDaprComponentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, connectedEnvironmentName, componentName, daprComponentEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2024-10-02-preview +func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope ConnectedEnvironmentDaprComponent, options *ConnectedEnvironmentsDaprComponentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error - const operationName = "ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate" + const operationName = "ConnectedEnvironmentsDaprComponentsClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, daprComponentEnvelope, options) if err != nil { - return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) - return ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse{}, err + return nil, err } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err + return httpResp, nil } // 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) { +func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope ConnectedEnvironmentDaprComponent, options *ConnectedEnvironmentsDaprComponentsClientBeginCreateOrUpdateOptions) (*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") @@ -100,7 +120,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, daprComponentEnvelope); err != nil { @@ -109,47 +129,60 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateCreateReq return req, nil } -// 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. +// BeginDelete - Delete a Dapr Component from a connected environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 +// - options - ConnectedEnvironmentsDaprComponentsClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.BeginDelete // method. -func (client *ConnectedEnvironmentsDaprComponentsClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientDeleteOptions) (ConnectedEnvironmentsDaprComponentsClientDeleteResponse, error) { +func (client *ConnectedEnvironmentsDaprComponentsClient) BeginDelete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientBeginDeleteOptions) (*runtime.Poller[ConnectedEnvironmentsDaprComponentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, connectedEnvironmentName, componentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsDaprComponentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConnectedEnvironmentsDaprComponentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Dapr Component from a connected environment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +func (client *ConnectedEnvironmentsDaprComponentsClient) deleteOperation(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "ConnectedEnvironmentsDaprComponentsClient.Delete" + const operationName = "ConnectedEnvironmentsDaprComponentsClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, componentName, options) if err != nil { - return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) - return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, err + return nil, err } - return ConnectedEnvironmentsDaprComponentsClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *ConnectedEnvironmentsDaprComponentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientDeleteOptions) (*policy.Request, error) { +func (client *ConnectedEnvironmentsDaprComponentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *ConnectedEnvironmentsDaprComponentsClientBeginDeleteOptions) (*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") @@ -172,7 +205,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +214,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) deleteCreateRequest(ctx // Get - Get a dapr component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -233,7 +266,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) getCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,7 +275,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) getCreateRequest(ctx co // 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 { + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentDaprComponent); err != nil { return ConnectedEnvironmentsDaprComponentsClientGetResponse{}, err } return result, nil @@ -250,7 +283,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) getHandleResponse(resp // NewListPager - Get the Dapr Components for a connected environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -298,7 +331,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) listCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,7 +340,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) listCreateRequest(ctx c // 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 { + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentDaprComponentsCollection); err != nil { return ConnectedEnvironmentsDaprComponentsClientListResponse{}, err } return result, nil @@ -316,7 +349,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) listHandleResponse(resp // ListSecrets - List secrets for a dapr component // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -368,7 +401,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) listSecretsCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go deleted file mode 100644 index 1730f7a9211f..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go +++ /dev/null @@ -1,308 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - // }}, - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // Version: to.Ptr("v1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - // }}, - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // Version: to.Ptr("v1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - }}, - ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - { - Name: to.Ptr("statestore"), - Metadata: &armappcontainers.DaprServiceBindMetadata{ - Name: to.Ptr("daprcomponentBind"), - Value: to.Ptr("redis-bind"), - }, - ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - }}, - 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"), - // }}, - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // Version: to.Ptr("v1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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 index d1c9c1376e74..d12523532cc5 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -44,40 +43,61 @@ func NewConnectedEnvironmentsStoragesClient(subscriptionID string, credential az return client, nil } -// CreateOrUpdate - Create or update storage for a connectedEnvironment. +// BeginCreateOrUpdate - Create or update storage for a connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 +// - options - ConnectedEnvironmentsStoragesClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.BeginCreateOrUpdate // method. -func (client *ConnectedEnvironmentsStoragesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope ConnectedEnvironmentStorage, options *ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions) (ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse, error) { +func (client *ConnectedEnvironmentsStoragesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope ConnectedEnvironmentStorage, options *ConnectedEnvironmentsStoragesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, connectedEnvironmentName, storageName, storageEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update storage for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +func (client *ConnectedEnvironmentsStoragesClient) createOrUpdate(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope ConnectedEnvironmentStorage, options *ConnectedEnvironmentsStoragesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error - const operationName = "ConnectedEnvironmentsStoragesClient.CreateOrUpdate" + const operationName = "ConnectedEnvironmentsStoragesClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, storageName, storageEnvelope, options) if err != nil { - return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) - return ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse{}, err + return nil, err } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err + return httpResp, nil } // 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) { +func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope ConnectedEnvironmentStorage, options *ConnectedEnvironmentsStoragesClientBeginCreateOrUpdateOptions) (*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") @@ -100,7 +120,7 @@ func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, storageEnvelope); err != nil { @@ -109,47 +129,60 @@ func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateCreateRequest(c return req, nil } -// 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. +// BeginDelete - Delete storage for a connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 +// - options - ConnectedEnvironmentsStoragesClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.BeginDelete // method. -func (client *ConnectedEnvironmentsStoragesClient) Delete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientDeleteOptions) (ConnectedEnvironmentsStoragesClientDeleteResponse, error) { +func (client *ConnectedEnvironmentsStoragesClient) BeginDelete(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientBeginDeleteOptions) (*runtime.Poller[ConnectedEnvironmentsStoragesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, connectedEnvironmentName, storageName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedEnvironmentsStoragesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConnectedEnvironmentsStoragesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete storage for a connectedEnvironment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +func (client *ConnectedEnvironmentsStoragesClient) deleteOperation(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "ConnectedEnvironmentsStoragesClient.Delete" + const operationName = "ConnectedEnvironmentsStoragesClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectedEnvironmentName, storageName, options) if err != nil { - return ConnectedEnvironmentsStoragesClientDeleteResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ConnectedEnvironmentsStoragesClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) - return ConnectedEnvironmentsStoragesClientDeleteResponse{}, err + return nil, err } - return ConnectedEnvironmentsStoragesClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *ConnectedEnvironmentsStoragesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientDeleteOptions) (*policy.Request, error) { +func (client *ConnectedEnvironmentsStoragesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *ConnectedEnvironmentsStoragesClientBeginDeleteOptions) (*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") @@ -172,7 +205,7 @@ func (client *ConnectedEnvironmentsStoragesClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +214,7 @@ func (client *ConnectedEnvironmentsStoragesClient) deleteCreateRequest(ctx conte // Get - Get storage for a connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - connectedEnvironmentName - Name of the Environment. // - storageName - Name of the storage. @@ -233,7 +266,7 @@ func (client *ConnectedEnvironmentsStoragesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +284,7 @@ func (client *ConnectedEnvironmentsStoragesClient) getHandleResponse(resp *http. // List - Get all storages for a connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -298,7 +331,7 @@ func (client *ConnectedEnvironmentsStoragesClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go deleted file mode 100644 index ef1c8a2a36cf..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go +++ /dev/null @@ -1,144 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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 93c1912a915b..cfe442b2d7dd 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/constants.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/constants.go @@ -10,7 +10,7 @@ package armappcontainers const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers" - moduleVersion = "v3.1.0-beta.1" + moduleVersion = "v3.1.0-beta.2" ) // AccessMode - Access mode for storage @@ -45,12 +45,14 @@ func PossibleActionValues() []Action { } } -// 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. +// ActiveRevisionsMode - ActiveRevisionsMode controls how active revisions are handled for the Container app:Single: Only +// one revision can be active at a time. Traffic weights cannot be used. This is the default.Multiple: +// Multiple revisions can be active, including optional traffic weights and labels.Labels: Only revisions with labels are +// active. Traffic weights can be applied to labels. type ActiveRevisionsMode string const ( + ActiveRevisionsModeLabels ActiveRevisionsMode = "Labels" ActiveRevisionsModeMultiple ActiveRevisionsMode = "Multiple" ActiveRevisionsModeSingle ActiveRevisionsMode = "Single" ) @@ -58,6 +60,7 @@ const ( // PossibleActiveRevisionsModeValues returns the possible values for the ActiveRevisionsMode const type. func PossibleActiveRevisionsModeValues() []ActiveRevisionsMode { return []ActiveRevisionsMode{ + ActiveRevisionsModeLabels, ActiveRevisionsModeMultiple, ActiveRevisionsModeSingle, } @@ -115,6 +118,7 @@ func PossibleApplicabilityValues() []Applicability { type BindingType string const ( + BindingTypeAuto BindingType = "Auto" BindingTypeDisabled BindingType = "Disabled" BindingTypeSniEnabled BindingType = "SniEnabled" ) @@ -122,6 +126,7 @@ const ( // PossibleBindingTypeValues returns the possible values for the BindingType const type. func PossibleBindingTypeValues() []BindingType { return []BindingType{ + BindingTypeAuto, BindingTypeDisabled, BindingTypeSniEnabled, } @@ -251,6 +256,26 @@ func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { } } +// ConnectedEnvironmentDaprComponentProvisioningState - Provisioning state of the Connected Environment Dapr Component. +type ConnectedEnvironmentDaprComponentProvisioningState string + +const ( + ConnectedEnvironmentDaprComponentProvisioningStateCanceled ConnectedEnvironmentDaprComponentProvisioningState = "Canceled" + ConnectedEnvironmentDaprComponentProvisioningStateFailed ConnectedEnvironmentDaprComponentProvisioningState = "Failed" + ConnectedEnvironmentDaprComponentProvisioningStateInProgress ConnectedEnvironmentDaprComponentProvisioningState = "InProgress" + ConnectedEnvironmentDaprComponentProvisioningStateSucceeded ConnectedEnvironmentDaprComponentProvisioningState = "Succeeded" +) + +// PossibleConnectedEnvironmentDaprComponentProvisioningStateValues returns the possible values for the ConnectedEnvironmentDaprComponentProvisioningState const type. +func PossibleConnectedEnvironmentDaprComponentProvisioningStateValues() []ConnectedEnvironmentDaprComponentProvisioningState { + return []ConnectedEnvironmentDaprComponentProvisioningState{ + ConnectedEnvironmentDaprComponentProvisioningStateCanceled, + ConnectedEnvironmentDaprComponentProvisioningStateFailed, + ConnectedEnvironmentDaprComponentProvisioningStateInProgress, + ConnectedEnvironmentDaprComponentProvisioningStateSucceeded, + } +} + // ConnectedEnvironmentProvisioningState - Provisioning state of the Kubernetes Environment. type ConnectedEnvironmentProvisioningState string @@ -279,6 +304,26 @@ func PossibleConnectedEnvironmentProvisioningStateValues() []ConnectedEnvironmen } } +// ConnectedEnvironmentStorageProvisioningState - Provisioning state of the storage. +type ConnectedEnvironmentStorageProvisioningState string + +const ( + ConnectedEnvironmentStorageProvisioningStateCanceled ConnectedEnvironmentStorageProvisioningState = "Canceled" + ConnectedEnvironmentStorageProvisioningStateFailed ConnectedEnvironmentStorageProvisioningState = "Failed" + ConnectedEnvironmentStorageProvisioningStateInProgress ConnectedEnvironmentStorageProvisioningState = "InProgress" + ConnectedEnvironmentStorageProvisioningStateSucceeded ConnectedEnvironmentStorageProvisioningState = "Succeeded" +) + +// PossibleConnectedEnvironmentStorageProvisioningStateValues returns the possible values for the ConnectedEnvironmentStorageProvisioningState const type. +func PossibleConnectedEnvironmentStorageProvisioningStateValues() []ConnectedEnvironmentStorageProvisioningState { + return []ConnectedEnvironmentStorageProvisioningState{ + ConnectedEnvironmentStorageProvisioningStateCanceled, + ConnectedEnvironmentStorageProvisioningStateFailed, + ConnectedEnvironmentStorageProvisioningStateInProgress, + ConnectedEnvironmentStorageProvisioningStateSucceeded, + } +} + // ContainerAppContainerRunningState - Current running state of the container type ContainerAppContainerRunningState string @@ -337,6 +382,33 @@ func PossibleContainerAppReplicaRunningStateValues() []ContainerAppReplicaRunnin } } +// ContainerAppRunningStatus - Running status of the Container App. +type ContainerAppRunningStatus string + +const ( + // ContainerAppRunningStatusProgressing - Container App is transitioning between Stopped and Running states. + ContainerAppRunningStatusProgressing ContainerAppRunningStatus = "Progressing" + // ContainerAppRunningStatusReady - Container App Job is in Ready state. + ContainerAppRunningStatusReady ContainerAppRunningStatus = "Ready" + // ContainerAppRunningStatusRunning - Container App is in Running state. + ContainerAppRunningStatusRunning ContainerAppRunningStatus = "Running" + // ContainerAppRunningStatusStopped - Container App is in Stopped state. + ContainerAppRunningStatusStopped ContainerAppRunningStatus = "Stopped" + // ContainerAppRunningStatusSuspended - Container App Job is in Suspended state. + ContainerAppRunningStatusSuspended ContainerAppRunningStatus = "Suspended" +) + +// PossibleContainerAppRunningStatusValues returns the possible values for the ContainerAppRunningStatus const type. +func PossibleContainerAppRunningStatusValues() []ContainerAppRunningStatus { + return []ContainerAppRunningStatus{ + ContainerAppRunningStatusProgressing, + ContainerAppRunningStatusReady, + ContainerAppRunningStatusRunning, + ContainerAppRunningStatusStopped, + ContainerAppRunningStatusSuspended, + } +} + // ContainerType - The container type of the sessions. type ContainerType string @@ -539,6 +611,32 @@ func PossibleForwardProxyConventionValues() []ForwardProxyConvention { } } +// HTTPRouteProvisioningState - The current provisioning state. +type HTTPRouteProvisioningState string + +const ( + HTTPRouteProvisioningStateCanceled HTTPRouteProvisioningState = "Canceled" + HTTPRouteProvisioningStateDeleting HTTPRouteProvisioningState = "Deleting" + HTTPRouteProvisioningStateFailed HTTPRouteProvisioningState = "Failed" + HTTPRouteProvisioningStatePending HTTPRouteProvisioningState = "Pending" + HTTPRouteProvisioningStateSucceeded HTTPRouteProvisioningState = "Succeeded" + HTTPRouteProvisioningStateUpdating HTTPRouteProvisioningState = "Updating" + HTTPRouteProvisioningStateWaiting HTTPRouteProvisioningState = "Waiting" +) + +// PossibleHTTPRouteProvisioningStateValues returns the possible values for the HTTPRouteProvisioningState const type. +func PossibleHTTPRouteProvisioningStateValues() []HTTPRouteProvisioningState { + return []HTTPRouteProvisioningState{ + HTTPRouteProvisioningStateCanceled, + HTTPRouteProvisioningStateDeleting, + HTTPRouteProvisioningStateFailed, + HTTPRouteProvisioningStatePending, + HTTPRouteProvisioningStateSucceeded, + HTTPRouteProvisioningStateUpdating, + HTTPRouteProvisioningStateWaiting, + } +} + // IdentitySettingsLifeCycle - Use to select the lifecycle stages of a Container App during which the Managed Identity should // be available. type IdentitySettingsLifeCycle string @@ -1220,6 +1318,36 @@ func PossibleUnauthenticatedClientActionV2Values() []UnauthenticatedClientAction } } +// WeekDay - Day of the week when a managed environment can be patched. +type WeekDay string + +const ( + WeekDayEveryday WeekDay = "Everyday" + WeekDayFriday WeekDay = "Friday" + WeekDayMonday WeekDay = "Monday" + WeekDaySaturday WeekDay = "Saturday" + WeekDaySunday WeekDay = "Sunday" + WeekDayThursday WeekDay = "Thursday" + WeekDayTuesday WeekDay = "Tuesday" + WeekDayWednesday WeekDay = "Wednesday" + WeekDayWeekend WeekDay = "Weekend" +) + +// PossibleWeekDayValues returns the possible values for the WeekDay const type. +func PossibleWeekDayValues() []WeekDay { + return []WeekDay{ + WeekDayEveryday, + WeekDayFriday, + WeekDayMonday, + WeekDaySaturday, + WeekDaySunday, + WeekDayThursday, + WeekDayTuesday, + WeekDayWednesday, + WeekDayWeekend, + } +} + // WorkflowHealthState - Gets or sets the workflow health state. type WorkflowHealthState string diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go index ab664ab26982..66cb8bf2b012 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsClient contains the methods for the ContainerApps group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -74,7 +73,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsClient) createOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsClient.BeginCreateOrUpdate" @@ -116,7 +115,7 @@ func (client *ContainerAppsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, containerAppEnvelope); err != nil { @@ -128,7 +127,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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -154,7 +153,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsClient.BeginDelete" @@ -196,7 +195,7 @@ func (client *ContainerAppsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +204,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -251,7 +250,7 @@ func (client *ContainerAppsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +268,7 @@ func (client *ContainerAppsClient) getHandleResponse(resp *http.Response) (Conta // GetAuthToken - Get auth token for a container app // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -316,7 +315,7 @@ func (client *ContainerAppsClient) getAuthTokenCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -333,7 +332,7 @@ func (client *ContainerAppsClient) getAuthTokenHandleResponse(resp *http.Respons // NewListByResourceGroupPager - Get the Container Apps in a given resource group. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ContainerAppsClientListByResourceGroupOptions contains the optional parameters for the ContainerAppsClient.NewListByResourceGroupPager // method. @@ -376,7 +375,7 @@ func (client *ContainerAppsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -393,7 +392,7 @@ func (client *ContainerAppsClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - Get the Container Apps in a given subscription. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - options - ContainerAppsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsClient.NewListBySubscriptionPager // method. func (client *ContainerAppsClient) NewListBySubscriptionPager(options *ContainerAppsClientListBySubscriptionOptions) *runtime.Pager[ContainerAppsClientListBySubscriptionResponse] { @@ -431,7 +430,7 @@ func (client *ContainerAppsClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -449,7 +448,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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -496,7 +495,7 @@ func (client *ContainerAppsClient) listCustomHostNameAnalysisCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") if options != nil && options.CustomHostname != nil { reqQP.Set("customHostname", *options.CustomHostname) } @@ -517,7 +516,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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -564,7 +563,7 @@ func (client *ContainerAppsClient) listSecretsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -582,7 +581,7 @@ func (client *ContainerAppsClient) listSecretsHandleResponse(resp *http.Response // BeginStart - Start a container app // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - options - ContainerAppsClientBeginStartOptions contains the optional parameters for the ContainerAppsClient.BeginStart @@ -608,7 +607,7 @@ func (client *ContainerAppsClient) BeginStart(ctx context.Context, resourceGroup // Start - Start a container app // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsClient) start(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsClient.BeginStart" @@ -650,7 +649,7 @@ func (client *ContainerAppsClient) startCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -659,7 +658,7 @@ func (client *ContainerAppsClient) startCreateRequest(ctx context.Context, resou // BeginStop - Stop a container app // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - options - ContainerAppsClientBeginStopOptions contains the optional parameters for the ContainerAppsClient.BeginStop method. @@ -684,7 +683,7 @@ func (client *ContainerAppsClient) BeginStop(ctx context.Context, resourceGroupN // Stop - Stop a container app // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsClient) stop(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsClient.BeginStop" @@ -726,7 +725,7 @@ func (client *ContainerAppsClient) stopCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -735,7 +734,7 @@ func (client *ContainerAppsClient) stopCreateRequest(ctx context.Context, resour // BeginUpdate - Patches a Container App using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -761,7 +760,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsClient) update(ctx context.Context, resourceGroupName string, containerAppName string, containerAppEnvelope ContainerApp, options *ContainerAppsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsClient.BeginUpdate" @@ -803,7 +802,7 @@ func (client *ContainerAppsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, containerAppEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go deleted file mode 100644 index 21bd838105aa..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go +++ /dev/null @@ -1,2782 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListBySubscription.json -func ExampleContainerAppsClient_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.NewContainerAppsClient().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.ContainerAppCollection = armappcontainers.ContainerAppCollection{ - // Value: []*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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // Service: &armappcontainers.Service{ - // Type: to.Ptr("redis"), - // }, - // }, - // 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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // Rules: []*armappcontainers.ScaleRule{ - // { - // Name: to.Ptr("httpscalingrule"), - // HTTP: &armappcontainers.HTTPScaleRule{ - // Metadata: map[string]*string{ - // "concurrentRequests": to.Ptr("50"), - // }, - // }, - // }}, - // }, - // ServiceBinds: []*armappcontainers.ServiceBind{ - // { - // Name: to.Ptr("service"), - // ClientType: to.Ptr("dotnet"), - // CustomizedKeys: map[string]*string{ - // "DesiredKey": to.Ptr("defaultKey"), - // }, - // ServiceID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service"), - // }}, - // }, - // WorkloadProfileName: to.Ptr("My-GP-01"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListByResourceGroup.json -func ExampleContainerAppsClient_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.NewContainerAppsClient().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.ContainerAppCollection = armappcontainers.ContainerAppCollection{ - // Value: []*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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // }, - // 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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // Rules: []*armappcontainers.ScaleRule{ - // { - // Name: to.Ptr("httpscalingrule"), - // HTTP: &armappcontainers.HTTPScaleRule{ - // Metadata: map[string]*string{ - // "concurrentRequests": to.Ptr("50"), - // }, - // }, - // }}, - // }, - // }, - // WorkloadProfileName: to.Ptr("My-GP-01"), - // }, - // }, - // { - // Name: to.Ptr("testcontainerApp1"), - // Type: to.Ptr("Microsoft.App/containerApps"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp1"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.ContainerAppProperties{ - // Configuration: &armappcontainers.Configuration{ - // Ingress: &armappcontainers.Ingress{ - // External: to.Ptr(true), - // Fqdn: to.Ptr("testcontainerApp1.demokube-t24clv0g.eastus.containerApps.k4apps.io"), - // TargetPort: to.Ptr[int32](3000), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // Transport: to.Ptr(armappcontainers.IngressTransportMethodAuto), - // }, - // MaxInactiveRevisions: to.Ptr[int32](10), - // }, - // DeploymentErrors: to.Ptr("Code: ContainerAppImagePullProvisionError, Message: Error pulling the container image. Please check the image name or any registry credentials to access if required."), - // EventStreamEndpoint: to.Ptr("testEndpoint"), - // LatestReadyRevisionName: to.Ptr("testcontainerApp0-pjxhsye"), - // LatestRevisionFqdn: to.Ptr("testcontainerApp1-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("testcontainerApp1"), - // Image: to.Ptr("repo/testcontainerApp1:v4"), - // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.2), - // Memory: to.Ptr("100Mi"), - // }, - // }}, - // InitContainers: []*armappcontainers.InitContainer{ - // { - // Name: to.Ptr("testcontainerApp1"), - // Image: to.Ptr("repo/testcontainerApp1:v4"), - // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.2), - // Memory: to.Ptr("100Mi"), - // }, - // }}, - // Scale: &armappcontainers.Scale{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // }, - // }, - // WorkloadProfileName: to.Ptr("Consumption"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Get.json -func ExampleContainerAppsClient_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.NewContainerAppsClient().Get(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"), - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("24adfa4f-dedf-8dc0-ca29-b6d1a69ab319"), - // TenantID: to.Ptr("23adfa4f-eedf-1dc0-ba29-a6d1a69ab3d0"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("14adfa4f-eedf-1dc0-ba29-a6d1a69ab3df"), - // PrincipalID: to.Ptr("74adfa4f-dedf-8dc0-ca29-b6d1a69ab312"), - // }, - // }, - // }, - // 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), - // }, - // IdentitySettings: []*armappcontainers.IdentitySettings{ - // { - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - // }, - // { - // Identity: to.Ptr("system"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - // }}, - // 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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // Service: &armappcontainers.Service{ - // Type: to.Ptr("redis"), - // }, - // }, - // 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"), - // }, - // VolumeMounts: []*armappcontainers.VolumeMount{ - // { - // MountPath: to.Ptr("/mnt/path1"), - // SubPath: to.Ptr("subPath1"), - // VolumeName: to.Ptr("azurefile"), - // }, - // { - // MountPath: to.Ptr("/mnt/path2"), - // SubPath: to.Ptr("subPath2"), - // VolumeName: to.Ptr("nfsazurefile"), - // }}, - // }}, - // 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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // Rules: []*armappcontainers.ScaleRule{ - // { - // Name: to.Ptr("httpscalingrule"), - // HTTP: &armappcontainers.HTTPScaleRule{ - // Metadata: map[string]*string{ - // "concurrentRequests": to.Ptr("50"), - // }, - // }, - // }, - // { - // Name: to.Ptr("servicebus"), - // Custom: &armappcontainers.CustomScaleRule{ - // Type: to.Ptr("azure-servicebus"), - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Metadata: map[string]*string{ - // "messageCount": to.Ptr("5"), - // "namespace": to.Ptr("mynamespace"), - // "queueName": to.Ptr("myqueue"), - // }, - // }, - // }}, - // }, - // ServiceBinds: []*armappcontainers.ServiceBind{ - // { - // Name: to.Ptr("service"), - // ClientType: to.Ptr("dotnet"), - // CustomizedKeys: map[string]*string{ - // "DesiredKey": to.Ptr("defaultKey"), - // }, - // ServiceID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service"), - // }}, - // Volumes: []*armappcontainers.Volume{ - // { - // Name: to.Ptr("azurefile"), - // StorageName: to.Ptr("storage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - // }, - // { - // Name: to.Ptr("nfsazurefile"), - // StorageName: to.Ptr("nfsStorage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - // }}, - // }, - // WorkloadProfileName: to.Ptr("My-GP-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Kind_CreateOrUpdate.json -func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateAppKind() { - 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", "testcontainerAppKind", armappcontainers.ContainerApp{ - Location: to.Ptr("East Us"), - Kind: to.Ptr(armappcontainers.KindWorkflowapp), - ManagedBy: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Web/sites/testcontainerAppKind"), - Properties: &armappcontainers.ContainerAppProperties{ - Configuration: &armappcontainers.Configuration{ - ActiveRevisionsMode: to.Ptr(armappcontainers.ActiveRevisionsModeSingle), - Ingress: &armappcontainers.Ingress{ - AllowInsecure: to.Ptr(true), - External: to.Ptr(true), - TargetPort: to.Ptr[int32](80), - }, - }, - ManagedEnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/testmanagedenv3"), - Template: &armappcontainers.Template{ - Containers: []*armappcontainers.Container{ - { - Name: to.Ptr("logicapps-container"), - Image: to.Ptr("default/logicapps-base:latest"), - Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](1), - Memory: to.Ptr("2.0Gi"), - }, - }}, - Scale: &armappcontainers.Scale{ - CooldownPeriod: to.Ptr[int32](350), - MaxReplicas: to.Ptr[int32](30), - MinReplicas: to.Ptr[int32](1), - PollingInterval: to.Ptr[int32](35), - }, - }, - }, - }, 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("testcontainerAppKind"), - // Type: to.Ptr("Microsoft.App/containerApps"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerapps/testcontainerAppKind"), - // Location: to.Ptr("East US"), - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeNone), - // }, - // Kind: to.Ptr(armappcontainers.KindWorkflowapp), - // ManagedBy: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Web/sites/testcontainerAppKind"), - // Properties: &armappcontainers.ContainerAppProperties{ - // Configuration: &armappcontainers.Configuration{ - // ActiveRevisionsMode: to.Ptr(armappcontainers.ActiveRevisionsModeSingle), - // Ingress: &armappcontainers.Ingress{ - // AllowInsecure: to.Ptr(true), - // ExposedPort: to.Ptr[int32](0), - // External: to.Ptr(true), - // Fqdn: to.Ptr("testcontainerAppKind.nicefield-53acf186.eastus.azurecontainerapps-test.io"), - // TargetPort: to.Ptr[int32](80), - // Traffic: []*armappcontainers.TrafficWeight{ - // { - // LatestRevision: to.Ptr(true), - // Weight: to.Ptr[int32](100), - // }}, - // Transport: to.Ptr(armappcontainers.IngressTransportMethodAuto), - // }, - // MaxInactiveRevisions: to.Ptr[int32](100), - // }, - // EnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/testmanagedenv3"), - // EventStreamEndpoint: to.Ptr("https://azurecontainerapps-test.dev/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/containerApps/testcontainerAppKind/eventstream"), - // LatestReadyRevisionName: to.Ptr("testcontainerAppKind--2rltv14"), - // LatestRevisionFqdn: to.Ptr("testcontainerAppKind--2rltv14.nicefield-53acf186.eastus.azurecontainerapps-test.io"), - // LatestRevisionName: to.Ptr("testcontainerAppKind--2rltv14"), - // ManagedEnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/testmanagedenv3"), - // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), - // Template: &armappcontainers.Template{ - // Containers: []*armappcontainers.Container{ - // { - // Name: to.Ptr("logicapps-container"), - // Image: to.Ptr("default/logicapps-base:latest"), - // ImageType: to.Ptr(armappcontainers.ImageTypeContainerImage), - // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](1), - // EphemeralStorage: to.Ptr("4Gi"), - // Memory: to.Ptr("2Gi"), - // }, - // }}, - // RevisionSuffix: to.Ptr(""), - // Scale: &armappcontainers.Scale{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](30), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_CreateOrUpdate_ConnectedEnvironment.json -func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateAppOnAConnectedEnvironment() { - 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", "testcontainerApp0", armappcontainers.ContainerApp{ - Location: to.Ptr("East US"), - ExtendedLocation: &armappcontainers.ExtendedLocation{ - Name: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation"), - Type: to.Ptr(armappcontainers.ExtendedLocationTypesCustomLocation), - }, - 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{ - AdditionalPortMappings: []*armappcontainers.IngressPortMapping{ - { - External: to.Ptr(true), - TargetPort: to.Ptr[int32](1234), - }, - { - ExposedPort: to.Ptr[int32](3456), - External: to.Ptr(false), - TargetPort: to.Ptr[int32](2345), - }}, - 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"), - BindingType: to.Ptr(armappcontainers.BindingTypeSniEnabled), - CertificateID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/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/connectedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com"), - }}, - 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{ - { - Label: to.Ptr("production"), - RevisionName: to.Ptr("testcontainerApp0-ab1234"), - Weight: to.Ptr[int32](100), - }}, - }, - MaxInactiveRevisions: to.Ptr[int32](10), - Runtime: &armappcontainers.Runtime{ - Dotnet: &armappcontainers.RuntimeDotnet{ - AutoConfigureDataProtection: to.Ptr(true), - }, - Java: &armappcontainers.RuntimeJava{ - EnableMetrics: to.Ptr(true), - JavaAgent: &armappcontainers.RuntimeJavaAgent{ - Enabled: to.Ptr(true), - Logging: &armappcontainers.RuntimeJavaAgentLogging{ - LoggerSettings: []*armappcontainers.LoggerSetting{ - { - Level: to.Ptr(armappcontainers.LevelDebug), - Logger: to.Ptr("org.springframework.boot"), - }}, - }, - }, - }, - }, - }, - EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube"), - Template: &armappcontainers.Template{ - Containers: []*armappcontainers.Container{ - { - Name: to.Ptr("testcontainerApp0"), - Image: to.Ptr("repo/testcontainerApp0: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("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{ - CooldownPeriod: to.Ptr[int32](350), - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), - PollingInterval: to.Ptr[int32](35), - Rules: []*armappcontainers.ScaleRule{ - { - Name: to.Ptr("httpscalingrule"), - Custom: &armappcontainers.CustomScaleRule{ - Type: to.Ptr("http"), - Metadata: map[string]*string{ - "concurrentRequests": 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("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"), - // ExtendedLocation: &armappcontainers.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation"), - // Type: to.Ptr(armappcontainers.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armappcontainers.ContainerAppProperties{ - // Configuration: &armappcontainers.Configuration{ - // Dapr: &armappcontainers.Dapr{ - // 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{ - // { - // 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/connectedEnvironments/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/connectedEnvironments/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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // }, - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // }, - // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube"), - // EventStreamEndpoint: to.Ptr("testEndpoint"), - // LatestReadyRevisionName: to.Ptr("testcontainerApp0-pjxhsye"), - // LatestRevisionFqdn: to.Ptr("testcontainerApp0-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), - // 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"), - // }, - // 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("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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // Rules: []*armappcontainers.ScaleRule{ - // { - // Name: to.Ptr("httpscalingrule"), - // HTTP: &armappcontainers.HTTPScaleRule{ - // Metadata: map[string]*string{ - // "concurrentRequests": to.Ptr("50"), - // }, - // }, - // }}, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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) - } - 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", "testcontainerApp0", armappcontainers.ContainerApp{ - Location: to.Ptr("East US"), - Identity: &armappcontainers.ManagedServiceIdentity{ - Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {}, - }, - }, - 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), - }, - IdentitySettings: []*armappcontainers.IdentitySettings{ - { - Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - }, - { - Identity: to.Ptr("system"), - Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - }}, - Ingress: &armappcontainers.Ingress{ - AdditionalPortMappings: []*armappcontainers.IngressPortMapping{ - { - External: to.Ptr(true), - TargetPort: to.Ptr[int32](1234), - }, - { - ExposedPort: to.Ptr[int32](3456), - External: to.Ptr(false), - TargetPort: to.Ptr[int32](2345), - }}, - 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"), - 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), - 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{ - { - Label: to.Ptr("production"), - RevisionName: to.Ptr("testcontainerApp0-ab1234"), - Weight: to.Ptr[int32](100), - }}, - }, - MaxInactiveRevisions: to.Ptr[int32](10), - Runtime: &armappcontainers.Runtime{ - Dotnet: &armappcontainers.RuntimeDotnet{ - AutoConfigureDataProtection: to.Ptr(true), - }, - Java: &armappcontainers.RuntimeJava{ - EnableMetrics: to.Ptr(true), - JavaAgent: &armappcontainers.RuntimeJavaAgent{ - Enabled: to.Ptr(true), - Logging: &armappcontainers.RuntimeJavaAgentLogging{ - LoggerSettings: []*armappcontainers.LoggerSetting{ - { - Level: to.Ptr(armappcontainers.LevelDebug), - Logger: to.Ptr("org.springframework.boot"), - }}, - }, - }, - }, - }, - Service: &armappcontainers.Service{ - Type: to.Ptr("redis"), - }, - }, - 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("testcontainerApp0"), - Image: to.Ptr("repo/testcontainerApp0:v1"), - VolumeMounts: []*armappcontainers.VolumeMount{ - { - MountPath: to.Ptr("/mnt/path1"), - SubPath: to.Ptr("subPath1"), - VolumeName: to.Ptr("azurefile"), - }, - { - MountPath: to.Ptr("/mnt/path2"), - SubPath: to.Ptr("subPath2"), - VolumeName: to.Ptr("nfsazurefile"), - }}, - 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("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{ - CooldownPeriod: to.Ptr[int32](350), - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), - PollingInterval: to.Ptr[int32](35), - Rules: []*armappcontainers.ScaleRule{ - { - Name: to.Ptr("httpscalingrule"), - Custom: &armappcontainers.CustomScaleRule{ - Type: to.Ptr("http"), - Metadata: map[string]*string{ - "concurrentRequests": to.Ptr("50"), - }, - }, - }, - { - Name: to.Ptr("servicebus"), - Custom: &armappcontainers.CustomScaleRule{ - Type: to.Ptr("azure-servicebus"), - Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - Metadata: map[string]*string{ - "messageCount": to.Ptr("5"), - "namespace": to.Ptr("mynamespace"), - "queueName": to.Ptr("myqueue"), - }, - }, - }, - { - Name: to.Ptr("azure-queue"), - AzureQueue: &armappcontainers.QueueScaleRule{ - AccountName: to.Ptr("account1"), - Identity: to.Ptr("system"), - QueueLength: to.Ptr[int32](1), - QueueName: to.Ptr("queue1"), - }, - }}, - }, - ServiceBinds: []*armappcontainers.ServiceBind{ - { - Name: to.Ptr("redisService"), - ClientType: to.Ptr("dotnet"), - CustomizedKeys: map[string]*string{ - "DesiredKey": to.Ptr("defaultKey"), - }, - ServiceID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService"), - }}, - Volumes: []*armappcontainers.Volume{ - { - Name: to.Ptr("azurefile"), - StorageName: to.Ptr("storage"), - StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - }, - { - Name: to.Ptr("nfsazurefile"), - StorageName: to.Ptr("nfsStorage"), - StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - }}, - }, - WorkloadProfileName: to.Ptr("My-GP-01"), - }, - }, 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("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"), - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("24adfa4f-dedf-8dc0-ca29-b6d1a69ab319"), - // TenantID: to.Ptr("23adfa4f-eedf-1dc0-ba29-a6d1a69ab3d0"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("14adfa4f-eedf-1dc0-ba29-a6d1a69ab3df"), - // PrincipalID: to.Ptr("74adfa4f-dedf-8dc0-ca29-b6d1a69ab312"), - // }, - // }, - // }, - // Properties: &armappcontainers.ContainerAppProperties{ - // Configuration: &armappcontainers.Configuration{ - // Dapr: &armappcontainers.Dapr{ - // AppPort: to.Ptr[int32](3000), - // AppProtocol: to.Ptr(armappcontainers.AppProtocolHTTP), - // Enabled: to.Ptr(true), - // HTTPReadBufferSize: to.Ptr[int32](30), - // }, - // IdentitySettings: []*armappcontainers.IdentitySettings{ - // { - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - // }, - // { - // Identity: to.Ptr("system"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - // }}, - // 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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // }, - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // }, - // 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"), - // }, - // VolumeMounts: []*armappcontainers.VolumeMount{ - // { - // MountPath: to.Ptr("/mnt/path1"), - // SubPath: to.Ptr("subPath1"), - // VolumeName: to.Ptr("azurefile"), - // }, - // { - // MountPath: to.Ptr("/mnt/path2"), - // SubPath: to.Ptr("subPath2"), - // VolumeName: to.Ptr("nfsazurefile"), - // }}, - // 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("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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // Rules: []*armappcontainers.ScaleRule{ - // { - // Name: to.Ptr("httpscalingrule"), - // HTTP: &armappcontainers.HTTPScaleRule{ - // Metadata: map[string]*string{ - // "concurrentRequests": to.Ptr("50"), - // }, - // }, - // }, - // { - // Name: to.Ptr("servicebus"), - // Custom: &armappcontainers.CustomScaleRule{ - // Type: to.Ptr("azure-servicebus"), - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Metadata: map[string]*string{ - // "messageCount": to.Ptr("5"), - // "namespace": to.Ptr("mynamespace"), - // "queueName": to.Ptr("myqueue"), - // }, - // }, - // }, - // { - // Name: to.Ptr("azure-queue"), - // AzureQueue: &armappcontainers.QueueScaleRule{ - // AccountName: to.Ptr("account1"), - // Identity: to.Ptr("system"), - // QueueLength: to.Ptr[int32](1), - // QueueName: to.Ptr("queue1"), - // }, - // }}, - // }, - // Volumes: []*armappcontainers.Volume{ - // { - // Name: to.Ptr("azurefile"), - // StorageName: to.Ptr("storage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - // }, - // { - // Name: to.Ptr("nfsazurefile"), - // StorageName: to.Ptr("nfsStorage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - // }}, - // }, - // WorkloadProfileName: to.Ptr("My-GP-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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{ - CooldownPeriod: to.Ptr[int32](350), - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), - PollingInterval: to.Ptr[int32](35), - 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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_SourceToCloudApp_CreateOrUpdate.json -func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateSourceToCloudApp() { - 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", "testcontainerApp0", armappcontainers.ContainerApp{ - 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{ - AdditionalPortMappings: []*armappcontainers.IngressPortMapping{ - { - External: to.Ptr(true), - TargetPort: to.Ptr[int32](1234), - }, - { - ExposedPort: to.Ptr[int32](3456), - External: to.Ptr(false), - TargetPort: to.Ptr[int32](2345), - }}, - 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"), - 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), - 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{ - { - Label: to.Ptr("production"), - RevisionName: to.Ptr("testcontainerApp0-ab1234"), - Weight: to.Ptr[int32](100), - }}, - }, - MaxInactiveRevisions: to.Ptr[int32](10), - Service: &armappcontainers.Service{ - Type: to.Ptr("redis"), - }, - }, - EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - PatchingConfiguration: &armappcontainers.ContainerAppPropertiesPatchingConfiguration{ - PatchingMode: to.Ptr(armappcontainers.PatchingModeAutomatic), - }, - Template: &armappcontainers.Template{ - Containers: []*armappcontainers.Container{ - { - Name: to.Ptr("testcontainerApp0"), - Image: to.Ptr(""), - ImageType: to.Ptr(armappcontainers.ImageTypeCloudBuild), - VolumeMounts: []*armappcontainers.VolumeMount{ - { - MountPath: to.Ptr("/mnt/path1"), - SubPath: to.Ptr("subPath1"), - VolumeName: to.Ptr("azurefile"), - }, - { - MountPath: to.Ptr("/mnt/path2"), - SubPath: to.Ptr("subPath2"), - VolumeName: to.Ptr("nfsazurefile"), - }}, - 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("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{ - CooldownPeriod: to.Ptr[int32](350), - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), - PollingInterval: to.Ptr[int32](35), - Rules: []*armappcontainers.ScaleRule{ - { - Name: to.Ptr("httpscalingrule"), - Custom: &armappcontainers.CustomScaleRule{ - Type: to.Ptr("http"), - Metadata: map[string]*string{ - "concurrentRequests": to.Ptr("50"), - }, - }, - }}, - }, - ServiceBinds: []*armappcontainers.ServiceBind{ - { - Name: to.Ptr("redisService"), - ClientType: to.Ptr("dotnet"), - CustomizedKeys: map[string]*string{ - "DesiredKey": to.Ptr("defaultKey"), - }, - ServiceID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService"), - }}, - Volumes: []*armappcontainers.Volume{ - { - Name: to.Ptr("azurefile"), - StorageName: to.Ptr("storage"), - StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - }, - { - Name: to.Ptr("nfsazurefile"), - StorageName: to.Ptr("nfsStorage"), - StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - }}, - }, - WorkloadProfileName: to.Ptr("My-GP-01"), - }, - }, 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("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), - // Enabled: to.Ptr(true), - // HTTPReadBufferSize: to.Ptr[int32](30), - // }, - // 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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // }, - // }, - // 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"), - // PatchingConfiguration: &armappcontainers.ContainerAppPropertiesPatchingConfiguration{ - // PatchingMode: to.Ptr(armappcontainers.PatchingModeAutomatic), - // }, - // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), - // Template: &armappcontainers.Template{ - // Containers: []*armappcontainers.Container{ - // { - // Name: to.Ptr("testcontainerApp0"), - // Image: to.Ptr("mcr.microsoft.com/k8se/cloudbuild-waiting-upload:latest"), - // ImageType: to.Ptr(armappcontainers.ImageTypeCloudBuild), - // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.2), - // Memory: to.Ptr("100Mi"), - // }, - // VolumeMounts: []*armappcontainers.VolumeMount{ - // { - // MountPath: to.Ptr("/mnt/path1"), - // SubPath: to.Ptr("subPath1"), - // VolumeName: to.Ptr("azurefile"), - // }, - // { - // MountPath: to.Ptr("/mnt/path2"), - // SubPath: to.Ptr("subPath2"), - // VolumeName: to.Ptr("nfsazurefile"), - // }}, - // 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("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"), - // }, - // }, - // }}, - // }, - // Volumes: []*armappcontainers.Volume{ - // { - // Name: to.Ptr("azurefile"), - // StorageName: to.Ptr("storage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - // }, - // { - // Name: to.Ptr("nfsazurefile"), - // StorageName: to.Ptr("nfsStorage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - // }}, - // }, - // WorkloadProfileName: to.Ptr("My-GP-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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{ - CooldownPeriod: to.Ptr[int32](350), - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), - PollingInterval: to.Ptr[int32](35), - 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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Delete.json -func ExampleContainerAppsClient_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.NewContainerAppsClient().BeginDelete(ctx, "rg", "testWorkerApp0", 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Patch.json -func ExampleContainerAppsClient_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.NewContainerAppsClient().BeginUpdate(ctx, "rg", "testcontainerApp0", armappcontainers.ContainerApp{ - Location: to.Ptr("East US"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - 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), - 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{ - { - Label: to.Ptr("production"), - RevisionName: to.Ptr("testcontainerApp0-ab1234"), - Weight: to.Ptr[int32](100), - }}, - }, - MaxInactiveRevisions: to.Ptr[int32](10), - Runtime: &armappcontainers.Runtime{ - Dotnet: &armappcontainers.RuntimeDotnet{ - AutoConfigureDataProtection: to.Ptr(true), - }, - Java: &armappcontainers.RuntimeJava{ - EnableMetrics: to.Ptr(true), - JavaAgent: &armappcontainers.RuntimeJavaAgent{ - Enabled: to.Ptr(true), - Logging: &armappcontainers.RuntimeJavaAgentLogging{ - LoggerSettings: []*armappcontainers.LoggerSetting{ - { - Level: to.Ptr(armappcontainers.LevelDebug), - Logger: to.Ptr("org.springframework.boot"), - }}, - }, - }, - }, - }, - Service: &armappcontainers.Service{ - Type: to.Ptr("redis"), - }, - }, - Template: &armappcontainers.Template{ - Containers: []*armappcontainers.Container{ - { - Name: to.Ptr("testcontainerApp0"), - Image: to.Ptr("repo/testcontainerApp0: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("testinitcontainerApp0"), - Image: to.Ptr("repo/testcontainerApp0:v4"), - Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](0.2), - Memory: to.Ptr("100Mi"), - }, - }}, - Scale: &armappcontainers.Scale{ - CooldownPeriod: to.Ptr[int32](350), - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), - PollingInterval: to.Ptr[int32](35), - Rules: []*armappcontainers.ScaleRule{ - { - Name: to.Ptr("httpscalingrule"), - Custom: &armappcontainers.CustomScaleRule{ - Type: to.Ptr("http"), - Metadata: map[string]*string{ - "concurrentRequests": to.Ptr("50"), - }, - }, - }}, - }, - ServiceBinds: []*armappcontainers.ServiceBind{ - { - Name: to.Ptr("service"), - ClientType: to.Ptr("dotnet"), - CustomizedKeys: map[string]*string{ - "DesiredKey": to.Ptr("defaultKey"), - }, - ServiceID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service"), - }}, - }, - }, - }, 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("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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // }, - // 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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json -func ExampleContainerAppsClient_ListCustomHostNameAnalysis() { - 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().ListCustomHostNameAnalysis(ctx, "rg", "testcontainerApp0", &armappcontainers.ContainerAppsClientListCustomHostNameAnalysisOptions{CustomHostname: to.Ptr("my.name.corp")}) - 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.CustomHostnameAnalysisResult = armappcontainers.CustomHostnameAnalysisResult{ - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListSecrets.json -func ExampleContainerAppsClient_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.NewContainerAppsClient().ListSecrets(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.SecretsCollection = armappcontainers.SecretsCollection{ - // Value: []*armappcontainers.ContainerAppSecret{ - // { - // Name: to.Ptr("secret1"), - // }, - // { - // Name: to.Ptr("secret2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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.308Z"); return t}()), - // Token: to.Ptr("testToken"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Start.json -func ExampleContainerAppsClient_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.NewContainerAppsClient().BeginStart(ctx, "rg", "testWorkerApp0", 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("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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // }, - // 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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Stop.json -func ExampleContainerAppsClient_BeginStop() { - 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().BeginStop(ctx, "rg", "testWorkerApp0", 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("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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // }, - // 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/containerappsapi_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client.go index c453cc31cf74..e120ccc29719 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsAPIClient contains the methods for the ContainerAppsAPIClient group. @@ -47,7 +46,7 @@ func NewContainerAppsAPIClient(subscriptionID string, credential azcore.TokenCre // GetCustomDomainVerificationID - Get the verification id of a subscription used for verifying custom domains // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - options - ContainerAppsAPIClientGetCustomDomainVerificationIDOptions contains the optional parameters for the ContainerAppsAPIClient.GetCustomDomainVerificationID // method. func (client *ContainerAppsAPIClient) GetCustomDomainVerificationID(ctx context.Context, options *ContainerAppsAPIClientGetCustomDomainVerificationIDOptions) (ContainerAppsAPIClientGetCustomDomainVerificationIDResponse, error) { @@ -84,7 +83,7 @@ func (client *ContainerAppsAPIClient) getCustomDomainVerificationIDCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -102,7 +101,7 @@ func (client *ContainerAppsAPIClient) getCustomDomainVerificationIDHandleRespons // JobExecution - Get details of a single job execution // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - jobExecutionName - Job execution name. @@ -154,7 +153,7 @@ func (client *ContainerAppsAPIClient) jobExecutionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client_example_test.go deleted file mode 100644 index aed27d2c0a45..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client_example_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Execution_Get.json -func ExampleContainerAppsAPIClient_JobExecution() { - 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.NewContainerAppsAPIClient().JobExecution(ctx, "rg", "testcontainerAppsJob0", "jobExecution1", 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.JobExecution = armappcontainers.JobExecution{ - // Name: to.Ptr("jobExecution1"), - // Properties: &armappcontainers.JobExecutionProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:47:30.000Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:37:30.000Z"); 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.5), - // Memory: to.Ptr("1Gi"), - // }, - // }}, - // 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.5), - // Memory: to.Ptr("1Gi"), - // }, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json -func ExampleContainerAppsAPIClient_GetCustomDomainVerificationID() { - 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.NewContainerAppsAPIClient().GetCustomDomainVerificationID(ctx, 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.Value = "5B406D5E790BBD224468CE0AA814C396203C7CE755F135A80E35D41865E51967" -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go index f39e84d13602..93e4782d6b7a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsAuthConfigsClient contains the methods for the ContainerAppsAuthConfigs group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -100,7 +99,7 @@ func (client *ContainerAppsAuthConfigsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, authConfigEnvelope); err != nil { @@ -121,7 +120,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -172,7 +171,7 @@ func (client *ContainerAppsAuthConfigsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +180,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -233,7 +232,7 @@ func (client *ContainerAppsAuthConfigsClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +249,7 @@ func (client *ContainerAppsAuthConfigsClient) getHandleResponse(resp *http.Respo // NewListByContainerAppPager - Get the Container App AuthConfigs in a given resource group. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -298,7 +297,7 @@ func (client *ContainerAppsAuthConfigsClient) listByContainerAppCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-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 deleted file mode 100644 index 7d0196ecd6aa..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client_example_test.go +++ /dev/null @@ -1,200 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_ListByContainer.json -func ExampleContainerAppsAuthConfigsClient_NewListByContainerAppPager() { - 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.NewContainerAppsAuthConfigsClient().NewListByContainerAppPager("workerapps-rg-xj", "testcanadacentral", 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.AuthConfigCollection = armappcontainers.AuthConfigCollection{ - // Value: []*armappcontainers.AuthConfig{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.App/containerapps/authconfigs"), - // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/providers/Microsoft.App/containerApps/testcanadacentral/authconfigs/current"), - // Properties: &armappcontainers.AuthConfigProperties{ - // EncryptionSettings: &armappcontainers.EncryptionSettings{ - // ContainerAppAuthEncryptionSecretName: to.Ptr("testEncryptionSecretName"), - // ContainerAppAuthSigningSecretName: to.Ptr("testSigningSecretName"), - // }, - // GlobalValidation: &armappcontainers.GlobalValidation{ - // UnauthenticatedClientAction: to.Ptr(armappcontainers.UnauthenticatedClientActionV2AllowAnonymous), - // }, - // IdentityProviders: &armappcontainers.IdentityProviders{ - // Facebook: &armappcontainers.Facebook{ - // Registration: &armappcontainers.AppRegistration{ - // AppID: to.Ptr("123"), - // AppSecretSettingName: to.Ptr("facebook-secret"), - // }, - // }, - // }, - // Platform: &armappcontainers.AuthPlatform{ - // Enabled: to.Ptr(true), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_Get.json -func ExampleContainerAppsAuthConfigsClient_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.NewContainerAppsAuthConfigsClient().Get(ctx, "workerapps-rg-xj", "testcanadacentral", "current", 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.AuthConfig = armappcontainers.AuthConfig{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.App/containerapps/authconfigs"), - // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/providers/Microsoft.App/containerApps/testcanadacentral/authconfigs/current"), - // Properties: &armappcontainers.AuthConfigProperties{ - // EncryptionSettings: &armappcontainers.EncryptionSettings{ - // ContainerAppAuthEncryptionSecretName: to.Ptr("testEncryptionSecretName"), - // ContainerAppAuthSigningSecretName: to.Ptr("testSigningSecretName"), - // }, - // GlobalValidation: &armappcontainers.GlobalValidation{ - // UnauthenticatedClientAction: to.Ptr(armappcontainers.UnauthenticatedClientActionV2AllowAnonymous), - // }, - // IdentityProviders: &armappcontainers.IdentityProviders{ - // Facebook: &armappcontainers.Facebook{ - // Registration: &armappcontainers.AppRegistration{ - // AppID: to.Ptr("123"), - // AppSecretSettingName: to.Ptr("facebook-secret"), - // }, - // }, - // }, - // Platform: &armappcontainers.AuthPlatform{ - // Enabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_CreateOrUpdate.json -func ExampleContainerAppsAuthConfigsClient_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.NewContainerAppsAuthConfigsClient().CreateOrUpdate(ctx, "workerapps-rg-xj", "testcanadacentral", "current", armappcontainers.AuthConfig{ - Properties: &armappcontainers.AuthConfigProperties{ - EncryptionSettings: &armappcontainers.EncryptionSettings{ - ContainerAppAuthEncryptionSecretName: to.Ptr("testEncryptionSecretName"), - ContainerAppAuthSigningSecretName: to.Ptr("testSigningSecretName"), - }, - GlobalValidation: &armappcontainers.GlobalValidation{ - UnauthenticatedClientAction: to.Ptr(armappcontainers.UnauthenticatedClientActionV2AllowAnonymous), - }, - IdentityProviders: &armappcontainers.IdentityProviders{ - Facebook: &armappcontainers.Facebook{ - Registration: &armappcontainers.AppRegistration{ - AppID: to.Ptr("123"), - AppSecretSettingName: to.Ptr("facebook-secret"), - }, - }, - }, - Platform: &armappcontainers.AuthPlatform{ - Enabled: to.Ptr(true), - }, - }, - }, 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.AuthConfig = armappcontainers.AuthConfig{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.App/containerapps/authconfigs"), - // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/providers/Microsoft.App/containerApps/myapp/authconfigs/current"), - // Properties: &armappcontainers.AuthConfigProperties{ - // EncryptionSettings: &armappcontainers.EncryptionSettings{ - // ContainerAppAuthEncryptionSecretName: to.Ptr("testEncryptionSecretName"), - // ContainerAppAuthSigningSecretName: to.Ptr("testSigningSecretName"), - // }, - // GlobalValidation: &armappcontainers.GlobalValidation{ - // UnauthenticatedClientAction: to.Ptr(armappcontainers.UnauthenticatedClientActionV2AllowAnonymous), - // }, - // IdentityProviders: &armappcontainers.IdentityProviders{ - // Facebook: &armappcontainers.Facebook{ - // Registration: &armappcontainers.AppRegistration{ - // AppID: to.Ptr("123"), - // AppSecretSettingName: to.Ptr("facebook-secret"), - // }, - // }, - // }, - // Platform: &armappcontainers.AuthPlatform{ - // Enabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_Delete.json -func ExampleContainerAppsAuthConfigsClient_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.NewContainerAppsAuthConfigsClient().Delete(ctx, "workerapps-rg-xj", "testcanadacentral", "current", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client.go index 61004bf94a25..b824864825b8 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsBuildsClient contains the methods for the ContainerAppsBuilds group. @@ -47,7 +46,7 @@ func NewContainerAppsBuildsClient(subscriptionID string, credential azcore.Token // BeginDelete - Delete a Container Apps Build resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App the Build is associated. // - buildName - The name of a build. @@ -74,7 +73,7 @@ func (client *ContainerAppsBuildsClient) BeginDelete(ctx context.Context, resour // Delete - Delete a Container Apps Build resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsBuildsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, buildName string, options *ContainerAppsBuildsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsBuildsClient.BeginDelete" @@ -120,7 +119,7 @@ func (client *ContainerAppsBuildsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -129,7 +128,7 @@ func (client *ContainerAppsBuildsClient) deleteCreateRequest(ctx context.Context // Get - Get a Container Apps Build resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App the Build is associated. // - buildName - The name of a build. @@ -180,7 +179,7 @@ func (client *ContainerAppsBuildsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client_example_test.go deleted file mode 100644 index f329bf80def6..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client_example_test.go +++ /dev/null @@ -1,121 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_Get.json -func ExampleContainerAppsBuildsClient_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.NewContainerAppsBuildsClient().Get(ctx, "rg", "testCapp", "testBuild", 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.ContainerAppsBuildResource = armappcontainers.ContainerAppsBuildResource{ - // Name: to.Ptr("testBuild"), - // Type: to.Ptr("Microsoft.App/containerApps/builds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/containerApps/testCapp/builds/testBuild"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Properties: &armappcontainers.ContainerAppsBuildProperties{ - // BuildStatus: to.Ptr(armappcontainers.BuildStatusInProgress), - // Configuration: &armappcontainers.ContainerAppsBuildConfiguration{ - // BaseOs: to.Ptr("DebianBullseye"), - // EnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // Platform: to.Ptr("dotnetcore"), - // PlatformVersion: to.Ptr("7.0"), - // PreBuildSteps: []*armappcontainers.PreBuildStep{ - // { - // Description: to.Ptr("First pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'world'")}, - // }, - // { - // Description: to.Ptr("Second pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'again'")}, - // }}, - // }, - // DestinationContainerRegistry: &armappcontainers.ContainerRegistryWithCustomImage{ - // Image: to.Ptr("test.azurecr.io/repo:tag"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // LogStreamEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/logstream"), - // ProvisioningState: to.Ptr(armappcontainers.BuildProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_Delete.json -func ExampleContainerAppsBuildsClient_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.NewContainerAppsBuildsClient().BeginDelete(ctx, "rg", "testCapp", "testBuild", 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) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client.go index 3327e91716b1..01c2d73a6420 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsBuildsByContainerAppClient contains the methods for the ContainerAppsBuildsByContainerApp group. @@ -46,7 +45,7 @@ func NewContainerAppsBuildsByContainerAppClient(subscriptionID string, credentia // NewListPager - List Container Apps Build resources by Container App // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App the Build is associated. // - options - ContainerAppsBuildsByContainerAppClientListOptions contains the optional parameters for the ContainerAppsBuildsByContainerAppClient.NewListPager @@ -94,7 +93,7 @@ func (client *ContainerAppsBuildsByContainerAppClient) listCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client_example_test.go deleted file mode 100644 index a023eade55b0..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client_example_test.go +++ /dev/null @@ -1,170 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_ListByContainerApp.json -func ExampleContainerAppsBuildsByContainerAppClient_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.NewContainerAppsBuildsByContainerAppClient().NewListPager("rg", "testCapp", 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.ContainerAppsBuildCollection = armappcontainers.ContainerAppsBuildCollection{ - // Value: []*armappcontainers.ContainerAppsBuildResource{ - // { - // Name: to.Ptr("testBuild1"), - // Type: to.Ptr("Microsoft.App/containerApps/builds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/containerApps/testCapp/builds/testBuild1"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Properties: &armappcontainers.ContainerAppsBuildProperties{ - // BuildStatus: to.Ptr(armappcontainers.BuildStatusInProgress), - // Configuration: &armappcontainers.ContainerAppsBuildConfiguration{ - // BaseOs: to.Ptr("DebianBullseye"), - // EnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // Platform: to.Ptr("dotnetcore"), - // PlatformVersion: to.Ptr("7.0"), - // PreBuildSteps: []*armappcontainers.PreBuildStep{ - // { - // Description: to.Ptr("First pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'world'")}, - // }, - // { - // Description: to.Ptr("Second pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'again'")}, - // }}, - // }, - // DestinationContainerRegistry: &armappcontainers.ContainerRegistryWithCustomImage{ - // Image: to.Ptr("test.azurecr.io/repo:tag"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // LogStreamEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/logstream"), - // ProvisioningState: to.Ptr(armappcontainers.BuildProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("testBuild2"), - // Type: to.Ptr("Microsoft.App/containerApps/builds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/containerApps/testCapp/builds/testBuild2"), - // SystemData: &armappcontainers.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // CreatedBy: to.Ptr("sample@microsoft.com"), - // CreatedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-11T11:05:51.494Z"); return t}()), - // LastModifiedBy: to.Ptr("sample@microsoft.com"), - // LastModifiedByType: to.Ptr(armappcontainers.CreatedByTypeUser), - // }, - // Properties: &armappcontainers.ContainerAppsBuildProperties{ - // BuildStatus: to.Ptr(armappcontainers.BuildStatusInProgress), - // Configuration: &armappcontainers.ContainerAppsBuildConfiguration{ - // BaseOs: to.Ptr("DebianBullseye"), - // EnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // Platform: to.Ptr("dotnetcore"), - // PlatformVersion: to.Ptr("7.0"), - // PreBuildSteps: []*armappcontainers.PreBuildStep{ - // { - // Description: to.Ptr("First pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo"), - // to.Ptr("bar")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'world'")}, - // }, - // { - // Description: to.Ptr("Second pre build step."), - // HTTPGet: &armappcontainers.HTTPGet{ - // FileName: to.Ptr("output.txt"), - // Headers: []*string{ - // to.Ptr("foo")}, - // URL: to.Ptr("https://microsoft.com"), - // }, - // Scripts: []*string{ - // to.Ptr("echo 'hello'"), - // to.Ptr("echo 'again'")}, - // }}, - // }, - // DestinationContainerRegistry: &armappcontainers.ContainerRegistryWithCustomImage{ - // Image: to.Ptr("test.azurecr.io/repo:tag"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // LogStreamEndpoint: to.Ptr("https://foo.azurecontainerapps.dev/logstream"), - // ProvisioningState: to.Ptr(armappcontainers.BuildProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go index a857a07a9b76..ee0414cdf755 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -47,7 +46,7 @@ func NewContainerAppsDiagnosticsClient(subscriptionID string, credential azcore. // GetDetector - Get a diagnostics result of a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -99,7 +98,7 @@ func (client *ContainerAppsDiagnosticsClient) getDetectorCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +116,7 @@ func (client *ContainerAppsDiagnosticsClient) getDetectorHandleResponse(resp *ht // GetRevision - Get a revision of a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -169,7 +168,7 @@ func (client *ContainerAppsDiagnosticsClient) getRevisionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,7 +186,7 @@ func (client *ContainerAppsDiagnosticsClient) getRevisionHandleResponse(resp *ht // GetRoot - Get the properties of a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -234,7 +233,7 @@ func (client *ContainerAppsDiagnosticsClient) getRootCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +250,7 @@ func (client *ContainerAppsDiagnosticsClient) getRootHandleResponse(resp *http.R // NewListDetectorsPager - Get the list of diagnostics for a given Container App. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -299,7 +298,7 @@ func (client *ContainerAppsDiagnosticsClient) listDetectorsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -316,7 +315,7 @@ func (client *ContainerAppsDiagnosticsClient) listDetectorsHandleResponse(resp * // NewListRevisionsPager - Get the Revisions for a given Container App. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -367,7 +366,7 @@ func (client *ContainerAppsDiagnosticsClient) listRevisionsCreateRequest(ctx con if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go deleted file mode 100644 index 9c884ff40e4e..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go +++ /dev/null @@ -1,472 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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.000Z"); 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.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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.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.000Z"); 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.000Z"); return t}()), - // Replicas: to.Ptr[int32](1), - // RunningState: to.Ptr(armappcontainers.RevisionRunningStateRunning), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("24adfa4f-dedf-8dc0-ca29-b6d1a69ab319"), - // TenantID: to.Ptr("23adfa4f-eedf-1dc0-ba29-a6d1a69ab3d0"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("14adfa4f-eedf-1dc0-ba29-a6d1a69ab3df"), - // PrincipalID: to.Ptr("74adfa4f-dedf-8dc0-ca29-b6d1a69ab312"), - // }, - // }, - // }, - // 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), - // }, - // IdentitySettings: []*armappcontainers.IdentitySettings{ - // { - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - // }, - // { - // Identity: to.Ptr("system"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - // }}, - // 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), - // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), - // 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), - // Runtime: &armappcontainers.Runtime{ - // Dotnet: &armappcontainers.RuntimeDotnet{ - // AutoConfigureDataProtection: to.Ptr(true), - // }, - // Java: &armappcontainers.RuntimeJava{ - // EnableMetrics: to.Ptr(true), - // JavaAgent: &armappcontainers.RuntimeJavaAgent{ - // Enabled: to.Ptr(true), - // Logging: &armappcontainers.RuntimeJavaAgentLogging{ - // LoggerSettings: []*armappcontainers.LoggerSetting{ - // { - // Level: to.Ptr(armappcontainers.LevelDebug), - // Logger: to.Ptr("org.springframework.boot"), - // }}, - // }, - // }, - // }, - // }, - // Service: &armappcontainers.Service{ - // Type: to.Ptr("redis"), - // }, - // }, - // 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"), - // }, - // VolumeMounts: []*armappcontainers.VolumeMount{ - // { - // MountPath: to.Ptr("/mnt/path1"), - // SubPath: to.Ptr("subPath1"), - // VolumeName: to.Ptr("azurefile"), - // }, - // { - // MountPath: to.Ptr("/mnt/path2"), - // SubPath: to.Ptr("subPath2"), - // VolumeName: to.Ptr("nfsazurefile"), - // }}, - // }}, - // 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{ - // CooldownPeriod: to.Ptr[int32](350), - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](35), - // Rules: []*armappcontainers.ScaleRule{ - // { - // Name: to.Ptr("httpscalingrule"), - // HTTP: &armappcontainers.HTTPScaleRule{ - // Metadata: map[string]*string{ - // "concurrentRequests": to.Ptr("50"), - // }, - // }, - // }, - // { - // Name: to.Ptr("servicebus"), - // Custom: &armappcontainers.CustomScaleRule{ - // Type: to.Ptr("azure-servicebus"), - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Metadata: map[string]*string{ - // "messageCount": to.Ptr("5"), - // "namespace": to.Ptr("mynamespace"), - // "queueName": to.Ptr("myqueue"), - // }, - // }, - // }}, - // }, - // ServiceBinds: []*armappcontainers.ServiceBind{ - // { - // Name: to.Ptr("service"), - // ClientType: to.Ptr("dotnet"), - // CustomizedKeys: map[string]*string{ - // "DesiredKey": to.Ptr("defaultKey"), - // }, - // ServiceID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service"), - // }}, - // Volumes: []*armappcontainers.Volume{ - // { - // Name: to.Ptr("azurefile"), - // StorageName: to.Ptr("storage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - // }, - // { - // Name: to.Ptr("nfsazurefile"), - // StorageName: to.Ptr("nfsStorage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - // }}, - // }, - // WorkloadProfileName: to.Ptr("My-GP-01"), - // }, - // } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappslabelhistory_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappslabelhistory_client.go new file mode 100644 index 000000000000..eca8b4a4374c --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappslabelhistory_client.go @@ -0,0 +1,182 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// ContainerAppsLabelHistoryClient contains the methods for the ContainerAppsLabelHistory group. +// Don't use this type directly, use NewContainerAppsLabelHistoryClient() instead. +type ContainerAppsLabelHistoryClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContainerAppsLabelHistoryClient creates a new instance of ContainerAppsLabelHistoryClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewContainerAppsLabelHistoryClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsLabelHistoryClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContainerAppsLabelHistoryClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetLabelHistory - Get the history of a label. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - containerAppName - Name of the Container App +// - labelName - Name of the Container App label. +// - options - ContainerAppsLabelHistoryClientGetLabelHistoryOptions contains the optional parameters for the ContainerAppsLabelHistoryClient.GetLabelHistory +// method. +func (client *ContainerAppsLabelHistoryClient) GetLabelHistory(ctx context.Context, resourceGroupName string, containerAppName string, labelName string, options *ContainerAppsLabelHistoryClientGetLabelHistoryOptions) (ContainerAppsLabelHistoryClientGetLabelHistoryResponse, error) { + var err error + const operationName = "ContainerAppsLabelHistoryClient.GetLabelHistory" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getLabelHistoryCreateRequest(ctx, resourceGroupName, containerAppName, labelName, options) + if err != nil { + return ContainerAppsLabelHistoryClientGetLabelHistoryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsLabelHistoryClientGetLabelHistoryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ContainerAppsLabelHistoryClientGetLabelHistoryResponse{}, err + } + resp, err := client.getLabelHistoryHandleResponse(httpResp) + return resp, err +} + +// getLabelHistoryCreateRequest creates the GetLabelHistory request. +func (client *ContainerAppsLabelHistoryClient) getLabelHistoryCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, labelName string, options *ContainerAppsLabelHistoryClientGetLabelHistoryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/labelHistory/{labelName}" + 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 labelName == "" { + return nil, errors.New("parameter labelName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{labelName}", url.PathEscape(labelName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getLabelHistoryHandleResponse handles the GetLabelHistory response. +func (client *ContainerAppsLabelHistoryClient) getLabelHistoryHandleResponse(resp *http.Response) (ContainerAppsLabelHistoryClientGetLabelHistoryResponse, error) { + result := ContainerAppsLabelHistoryClientGetLabelHistoryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LabelHistory); err != nil { + return ContainerAppsLabelHistoryClientGetLabelHistoryResponse{}, err + } + return result, nil +} + +// NewListLabelHistoryPager - Get the Label History for a given Container App. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - containerAppName - Name of the Container App +// - options - ContainerAppsLabelHistoryClientListLabelHistoryOptions contains the optional parameters for the ContainerAppsLabelHistoryClient.NewListLabelHistoryPager +// method. +func (client *ContainerAppsLabelHistoryClient) NewListLabelHistoryPager(resourceGroupName string, containerAppName string, options *ContainerAppsLabelHistoryClientListLabelHistoryOptions) *runtime.Pager[ContainerAppsLabelHistoryClientListLabelHistoryResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsLabelHistoryClientListLabelHistoryResponse]{ + More: func(page ContainerAppsLabelHistoryClientListLabelHistoryResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsLabelHistoryClientListLabelHistoryResponse) (ContainerAppsLabelHistoryClientListLabelHistoryResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainerAppsLabelHistoryClient.NewListLabelHistoryPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listLabelHistoryCreateRequest(ctx, resourceGroupName, containerAppName, options) + }, nil) + if err != nil { + return ContainerAppsLabelHistoryClientListLabelHistoryResponse{}, err + } + return client.listLabelHistoryHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listLabelHistoryCreateRequest creates the ListLabelHistory request. +func (client *ContainerAppsLabelHistoryClient) listLabelHistoryCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsLabelHistoryClientListLabelHistoryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/labelHistory" + 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() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listLabelHistoryHandleResponse handles the ListLabelHistory response. +func (client *ContainerAppsLabelHistoryClient) listLabelHistoryHandleResponse(resp *http.Response) (ContainerAppsLabelHistoryClientListLabelHistoryResponse, error) { + result := ContainerAppsLabelHistoryClientListLabelHistoryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LabelHistoryCollection); err != nil { + return ContainerAppsLabelHistoryClientListLabelHistoryResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client.go index b9a04f945f09..d320f96955e3 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsPatchesClient contains the methods for the ContainerAppsPatches group. @@ -47,7 +46,7 @@ func NewContainerAppsPatchesClient(subscriptionID string, credential azcore.Toke // BeginApply - Apply a Container Apps Patch resource with patch name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App the Patch is associated. // - patchName - The name of the patch @@ -74,7 +73,7 @@ func (client *ContainerAppsPatchesClient) BeginApply(ctx context.Context, resour // Apply - Apply a Container Apps Patch resource with patch name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsPatchesClient) apply(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *ContainerAppsPatchesClientBeginApplyOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsPatchesClient.BeginApply" @@ -120,7 +119,7 @@ func (client *ContainerAppsPatchesClient) applyCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -129,7 +128,7 @@ func (client *ContainerAppsPatchesClient) applyCreateRequest(ctx context.Context // BeginDelete - Delete specific Container Apps Patch by patch name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App the Patch is associated. // - patchName - The name of the patch @@ -156,7 +155,7 @@ func (client *ContainerAppsPatchesClient) BeginDelete(ctx context.Context, resou // Delete - Delete specific Container Apps Patch by patch name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsPatchesClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *ContainerAppsPatchesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsPatchesClient.BeginDelete" @@ -202,7 +201,7 @@ func (client *ContainerAppsPatchesClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +210,7 @@ func (client *ContainerAppsPatchesClient) deleteCreateRequest(ctx context.Contex // Get - Get details for specific Container Apps Patch by patch name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App the Patch is associated. // - patchName - The name of the patch @@ -263,7 +262,7 @@ func (client *ContainerAppsPatchesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +279,7 @@ func (client *ContainerAppsPatchesClient) getHandleResponse(resp *http.Response) // NewListByContainerAppPager - List Container Apps Patch resources by ContainerApp. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App the Patch is associated. // - options - ContainerAppsPatchesClientListByContainerAppOptions contains the optional parameters for the ContainerAppsPatchesClient.NewListByContainerAppPager @@ -331,7 +330,7 @@ func (client *ContainerAppsPatchesClient) listByContainerAppCreateRequest(ctx co if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +348,7 @@ func (client *ContainerAppsPatchesClient) listByContainerAppHandleResponse(resp // BeginSkipConfigure - Configure the Container Apps Patch skip option by patch name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App the Patch is associated. // - patchName - The name of the patch @@ -377,7 +376,7 @@ func (client *ContainerAppsPatchesClient) BeginSkipConfigure(ctx context.Context // SkipConfigure - Configure the Container Apps Patch skip option by patch name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsPatchesClient) skipConfigure(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, patchSkipConfig PatchSkipConfig, options *ContainerAppsPatchesClientBeginSkipConfigureOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsPatchesClient.BeginSkipConfigure" @@ -423,7 +422,7 @@ func (client *ContainerAppsPatchesClient) skipConfigureCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, patchSkipConfig); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client_example_test.go deleted file mode 100644 index 7ed73eaeb54a..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client_example_test.go +++ /dev/null @@ -1,281 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_ListByContainerApp.json -func ExampleContainerAppsPatchesClient_NewListByContainerAppPager() { - 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.NewContainerAppsPatchesClient().NewListByContainerAppPager("rg", "test-app", &armappcontainers.ContainerAppsPatchesClientListByContainerAppOptions{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.PatchCollection = armappcontainers.PatchCollection{ - // Value: []*armappcontainers.ContainerAppsPatchResource{ - // { - // Name: to.Ptr("testPatch-25fe4b"), - // Type: to.Ptr("Microsoft.App/containerApps/patches"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app/patches/testPatch-25fe4b"), - // Properties: &armappcontainers.PatchProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:20.342Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:20.342Z"); return t}()), - // PatchApplyStatus: to.Ptr(armappcontainers.PatchApplyStatusNotStarted), - // PatchDetails: []*armappcontainers.PatchDetails{ - // { - // DetectionStatus: to.Ptr(armappcontainers.DetectionStatusSucceeded), - // LastDetectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:19.524Z"); return t}()), - // NewImageName: to.Ptr("testregistry.azurecr.io/test-image:release-1-patched-202210101206185241"), - // NewLayer: &armappcontainers.PatchDetailsNewLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.9-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.9"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // OldLayer: &armappcontainers.PatchDetailsOldLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.7-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.7"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // PatchType: to.Ptr(armappcontainers.PatchTypeFrameworkSecurity), - // TargetContainerName: to.Ptr("test-container"), - // TargetImage: to.Ptr("testregistry.azurecr.io/test-image:release-1-patched-202209101206203421"), - // }}, - // TargetContainerAppID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app"), - // TargetEnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/test-env"), - // TargetRevisionID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/apps/test-app/revisions/test-app--jm3vvry"), - // }, - // }, - // { - // Name: to.Ptr("testPatch-27c3d5"), - // Type: to.Ptr("Microsoft.App/containerApps/patches"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app/patches/testPatch-27c3d5"), - // Properties: &armappcontainers.PatchProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-10T12:06:20.342Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-20T12:06:20.342Z"); return t}()), - // PatchApplyStatus: to.Ptr(armappcontainers.PatchApplyStatusSucceeded), - // PatchDetails: []*armappcontainers.PatchDetails{ - // { - // DetectionStatus: to.Ptr(armappcontainers.DetectionStatusSucceeded), - // LastDetectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-21T12:06:19.524Z"); return t}()), - // NewImageName: to.Ptr("testregistry.azurecr.io/test-image:release-1-patched-202209101206203421"), - // NewLayer: &armappcontainers.PatchDetailsNewLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.7-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.7"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // OldLayer: &armappcontainers.PatchDetailsOldLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.5-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.5"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // PatchType: to.Ptr(armappcontainers.PatchTypeFrameworkSecurity), - // TargetContainerName: to.Ptr("test-container"), - // TargetImage: to.Ptr("testregistry.azurecr.io/test-image:release-1"), - // }, - // { - // DetectionStatus: to.Ptr(armappcontainers.DetectionStatusSucceeded), - // LastDetectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-21T12:06:19.524Z"); return t}()), - // NewImageName: to.Ptr("testregistry.azurecr.io/test-image:release-2-patched-202209101206203421"), - // NewLayer: &armappcontainers.PatchDetailsNewLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.7-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.7"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // OldLayer: &armappcontainers.PatchDetailsOldLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.0-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.0"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // PatchType: to.Ptr(armappcontainers.PatchTypeFrameworkSecurity), - // TargetContainerName: to.Ptr("test-container-2"), - // TargetImage: to.Ptr("testregistry.azurecr.io/test-image:release-2"), - // }}, - // TargetContainerAppID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app"), - // TargetEnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/test-env"), - // TargetRevisionID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app2/revisions/test-app--z79h4oc"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Get.json -func ExampleContainerAppsPatchesClient_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.NewContainerAppsPatchesClient().Get(ctx, "rg", "test-app", "testPatch-25fe4b", 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.ContainerAppsPatchResource = armappcontainers.ContainerAppsPatchResource{ - // Name: to.Ptr("testPatch-25fe4b"), - // Type: to.Ptr("Microsoft.App/containerApps/patches"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app/patches/testPatch-25fe4b"), - // Properties: &armappcontainers.PatchProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:20.342Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:20.342Z"); return t}()), - // PatchApplyStatus: to.Ptr(armappcontainers.PatchApplyStatusNotStarted), - // PatchDetails: []*armappcontainers.PatchDetails{ - // { - // DetectionStatus: to.Ptr(armappcontainers.DetectionStatusSucceeded), - // LastDetectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:19.524Z"); return t}()), - // NewImageName: to.Ptr("testregistry.azurecr.io/test-image:latest-patched-202210101206"), - // NewLayer: &armappcontainers.PatchDetailsNewLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.7-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.7"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // OldLayer: &armappcontainers.PatchDetailsOldLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.5-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.5"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // PatchType: to.Ptr(armappcontainers.PatchTypeFrameworkSecurity), - // TargetContainerName: to.Ptr("test-container"), - // TargetImage: to.Ptr("testregistry.azurecr.io/test-image:latest"), - // }}, - // TargetContainerAppID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app"), - // TargetEnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/test-env"), - // TargetRevisionID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/apps/test-app/revisions/test-app--jm3vvry"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Delete.json -func ExampleContainerAppsPatchesClient_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.NewContainerAppsPatchesClient().BeginDelete(ctx, "rg", "test-app", "testPatch-25fe4b", 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Skip_Configure.json -func ExampleContainerAppsPatchesClient_BeginSkipConfigure() { - 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.NewContainerAppsPatchesClient().BeginSkipConfigure(ctx, "rg", "test-app", "testPatch-25fe4b", armappcontainers.PatchSkipConfig{ - Skip: to.Ptr(true), - }, 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Apply.json -func ExampleContainerAppsPatchesClient_BeginApply() { - 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.NewContainerAppsPatchesClient().BeginApply(ctx, "rg", "test-app", "testPatch-25fe4b", 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.ContainerAppsPatchResource = armappcontainers.ContainerAppsPatchResource{ - // Name: to.Ptr("testPatch-25fe4b"), - // Type: to.Ptr("Microsoft.App/containerApps/patches"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app/patches/testPatch-25fe4b"), - // Properties: &armappcontainers.PatchProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:20.342Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:20.342Z"); return t}()), - // PatchApplyStatus: to.Ptr(armappcontainers.PatchApplyStatusSucceeded), - // PatchDetails: []*armappcontainers.PatchDetails{ - // { - // DetectionStatus: to.Ptr(armappcontainers.DetectionStatusSucceeded), - // LastDetectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-10T12:06:19.524Z"); return t}()), - // NewImageName: to.Ptr("testregistry.azurecr.io/test-image:latest-patched-202210101206"), - // NewLayer: &armappcontainers.PatchDetailsNewLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.7-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.7"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // OldLayer: &armappcontainers.PatchDetailsOldLayer{ - // Name: to.Ptr("mcr.microsoft.com/dotnet/aspnet:7.0.5-cbl-mariner2.0"), - // FrameworkAndVersion: to.Ptr("dotnet:7.0.5"), - // OSAndVersion: to.Ptr("cbl-mariner2.0"), - // }, - // PatchType: to.Ptr(armappcontainers.PatchTypeFrameworkSecurity), - // TargetContainerName: to.Ptr("test-container"), - // TargetImage: to.Ptr("testregistry.azurecr.io/test-image:latest"), - // }}, - // TargetContainerAppID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/containerApps/test-app"), - // TargetEnvironmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/test-env"), - // TargetRevisionID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/apps/test-app/revisions/test-app--jm3vvry"), - // }, - // } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go index 726e985b3baa..d7d134c58894 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsRevisionReplicasClient contains the methods for the ContainerAppsRevisionReplicas group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -104,7 +103,7 @@ func (client *ContainerAppsRevisionReplicasClient) getReplicaCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -122,7 +121,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -174,7 +173,7 @@ func (client *ContainerAppsRevisionReplicasClient) listReplicasCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-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 deleted file mode 100644 index 06a5f2a15bfa..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client_example_test.go +++ /dev/null @@ -1,111 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Replicas_Get.json -func ExampleContainerAppsRevisionReplicasClient_GetReplica() { - 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.NewContainerAppsRevisionReplicasClient().GetReplica(ctx, "workerapps-rg-xj", "myapp", "myapp--0wlqy09", "myapp--0wlqy09-5d9774cff-5wnd8", 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.Replica = armappcontainers.Replica{ - // Name: to.Ptr("myapp--0wlqy09-5d9774cff-5wnd8"), - // Type: to.Ptr("Microsoft.Web/containerapps/revisions/replicas"), - // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/providers/Microsoft.App/containerApps/myapp/revisions/myapp--0wlqy09/replicas/myapp--0wlqy09-5d9774cff-5wnd8"), - // Properties: &armappcontainers.ReplicaProperties{ - // Containers: []*armappcontainers.ReplicaContainer{ - // { - // Name: to.Ptr("hello92"), - // ContainerID: to.Ptr("containerd://6bac7bb3afed1c704b5fe563c34c0ecf59ac30c766bb73488f7fa552dc42ee54"), - // DebugEndpoint: to.Ptr("wss://eastasia.azurecontainerapps.dev/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/containerApps/myapp/revisions/myapp--0wlqy09/replicas/myapp--0wlqy09-5d9774cff-5wnd8/debug?targetContainer=hello92"), - // ExecEndpoint: to.Ptr("testExecEndpoint"), - // LogStreamEndpoint: to.Ptr("testLogStreamEndpoint"), - // Ready: to.Ptr(true), - // RestartCount: to.Ptr[int32](0), - // RunningState: to.Ptr(armappcontainers.ContainerAppContainerRunningStateRunning), - // RunningStateDetails: to.Ptr("testDetail"), - // Started: to.Ptr(true), - // }}, - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-25T19:42:45.000Z"); return t}()), - // InitContainers: []*armappcontainers.ReplicaContainer{ - // }, - // RunningState: to.Ptr(armappcontainers.ContainerAppReplicaRunningStateRunning), - // RunningStateDetails: to.Ptr("testDetail"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Replicas_List.json -func ExampleContainerAppsRevisionReplicasClient_ListReplicas() { - 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.NewContainerAppsRevisionReplicasClient().ListReplicas(ctx, "workerapps-rg-xj", "myapp", "myapp--0wlqy09", 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.ReplicaCollection = armappcontainers.ReplicaCollection{ - // Value: []*armappcontainers.Replica{ - // { - // Name: to.Ptr("myapp--0wlqy09-5d9774cff-5wnd8"), - // Type: to.Ptr("Microsoft.Web/containerapps/revisions/replicas"), - // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/providers/Microsoft.App/containerApps/myapp/revisions/myapp--0wlqy09/replicas/myapp--0wlqy09-5d9774cff-5wnd8"), - // Properties: &armappcontainers.ReplicaProperties{ - // Containers: []*armappcontainers.ReplicaContainer{ - // { - // Name: to.Ptr("hello92"), - // ContainerID: to.Ptr("containerd://6bac7bb3afed1c704b5fe563c34c0ecf59ac30c766bb73488f7fa552dc42ee54"), - // DebugEndpoint: to.Ptr("wss://eastasia.azurecontainerapps.dev/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/containerApps/myapp/revisions/myapp--0wlqy09/replicas/myapp--0wlqy09-5d9774cff-5wnd8/debug?targetContainer=hello92"), - // ExecEndpoint: to.Ptr("testExecEndpoint"), - // LogStreamEndpoint: to.Ptr("testLogStreamEndpoint"), - // Ready: to.Ptr(true), - // RestartCount: to.Ptr[int32](0), - // RunningState: to.Ptr(armappcontainers.ContainerAppContainerRunningStateRunning), - // RunningStateDetails: to.Ptr("testDetail"), - // Started: to.Ptr(true), - // }}, - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-25T19:42:45.000Z"); return t}()), - // InitContainers: []*armappcontainers.ReplicaContainer{ - // }, - // RunningState: to.Ptr(armappcontainers.ContainerAppReplicaRunningStateRunning), - // RunningStateDetails: to.Ptr("testDetail"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go index e2339f64e161..1246a17d572d 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsRevisionsClient contains the methods for the ContainerAppsRevisions group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -98,7 +97,7 @@ func (client *ContainerAppsRevisionsClient) activateRevisionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,7 +106,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -158,7 +157,7 @@ func (client *ContainerAppsRevisionsClient) deactivateRevisionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -167,7 +166,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -219,7 +218,7 @@ func (client *ContainerAppsRevisionsClient) getRevisionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +235,7 @@ func (client *ContainerAppsRevisionsClient) getRevisionHandleResponse(resp *http // NewListRevisionsPager - Get the Revisions for a given Container App. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -287,7 +286,7 @@ func (client *ContainerAppsRevisionsClient) listRevisionsCreateRequest(ctx conte if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -305,7 +304,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -356,7 +355,7 @@ func (client *ContainerAppsRevisionsClient) restartRevisionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-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 deleted file mode 100644 index 44bf2f6ccccb..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client_example_test.go +++ /dev/null @@ -1,192 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_List.json -func ExampleContainerAppsRevisionsClient_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.NewContainerAppsRevisionsClient().NewListRevisionsPager("rg", "testcontainerApp0", &armappcontainers.ContainerAppsRevisionsClientListRevisionsOptions{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.000Z"); 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.000Z"); 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Get.json -func ExampleContainerAppsRevisionsClient_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.NewContainerAppsRevisionsClient().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.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.000Z"); 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.000Z"); return t}()), - // Replicas: to.Ptr[int32](1), - // RunningState: to.Ptr(armappcontainers.RevisionRunningStateRunning), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Activate.json -func ExampleContainerAppsRevisionsClient_ActivateRevision() { - 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.NewContainerAppsRevisionsClient().ActivateRevision(ctx, "rg", "testcontainerApp0", "testcontainerApp0-pjxhsye", 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Deactivate.json -func ExampleContainerAppsRevisionsClient_DeactivateRevision() { - 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.NewContainerAppsRevisionsClient().DeactivateRevision(ctx, "rg", "testcontainerApp0", "testcontainerApp0-pjxhsye", 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Restart.json -func ExampleContainerAppsRevisionsClient_RestartRevision() { - 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.NewContainerAppsRevisionsClient().RestartRevision(ctx, "rg", "testStaticSite0", "testcontainerApp0-pjxhsye", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client.go index 2204ef02833c..ee73f4d4604e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ContainerAppsSessionPoolsClient contains the methods for the ContainerAppsSessionPools group. @@ -47,7 +46,7 @@ func NewContainerAppsSessionPoolsClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - Create or update a session pool with the given properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sessionPoolName - Name of the session pool. // - sessionPoolEnvelope - Properties used to create a session pool @@ -74,7 +73,7 @@ func (client *ContainerAppsSessionPoolsClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - Create or update a session pool with the given properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsSessionPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, sessionPoolName string, sessionPoolEnvelope SessionPool, options *ContainerAppsSessionPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsSessionPoolsClient.BeginCreateOrUpdate" @@ -116,7 +115,7 @@ func (client *ContainerAppsSessionPoolsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, sessionPoolEnvelope); err != nil { @@ -128,7 +127,7 @@ func (client *ContainerAppsSessionPoolsClient) createOrUpdateCreateRequest(ctx c // BeginDelete - Delete the session pool with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sessionPoolName - Name of the session pool. // - options - ContainerAppsSessionPoolsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.BeginDelete @@ -154,7 +153,7 @@ func (client *ContainerAppsSessionPoolsClient) BeginDelete(ctx context.Context, // Delete - Delete the session pool with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsSessionPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, sessionPoolName string, options *ContainerAppsSessionPoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsSessionPoolsClient.BeginDelete" @@ -196,7 +195,7 @@ func (client *ContainerAppsSessionPoolsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +204,7 @@ func (client *ContainerAppsSessionPoolsClient) deleteCreateRequest(ctx context.C // Get - Get the properties of a session pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sessionPoolName - Name of the session pool. // - options - ContainerAppsSessionPoolsClientGetOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.Get @@ -252,7 +251,7 @@ func (client *ContainerAppsSessionPoolsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +268,7 @@ func (client *ContainerAppsSessionPoolsClient) getHandleResponse(resp *http.Resp // NewListByResourceGroupPager - Get the session pools in a given resource group of a subscription. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ContainerAppsSessionPoolsClientListByResourceGroupOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.NewListByResourceGroupPager // method. @@ -312,7 +311,7 @@ func (client *ContainerAppsSessionPoolsClient) listByResourceGroupCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +328,7 @@ func (client *ContainerAppsSessionPoolsClient) listByResourceGroupHandleResponse // NewListBySubscriptionPager - Get the session pools in a given subscription. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - options - ContainerAppsSessionPoolsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.NewListBySubscriptionPager // method. func (client *ContainerAppsSessionPoolsClient) NewListBySubscriptionPager(options *ContainerAppsSessionPoolsClientListBySubscriptionOptions) *runtime.Pager[ContainerAppsSessionPoolsClientListBySubscriptionResponse] { @@ -367,7 +366,7 @@ func (client *ContainerAppsSessionPoolsClient) listBySubscriptionCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +384,7 @@ func (client *ContainerAppsSessionPoolsClient) listBySubscriptionHandleResponse( // BeginUpdate - Patches a session pool using JSON merge patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sessionPoolName - Name of the session pool. // - sessionPoolEnvelope - Properties used to create a session pool @@ -412,7 +411,7 @@ func (client *ContainerAppsSessionPoolsClient) BeginUpdate(ctx context.Context, // Update - Patches a session pool using JSON merge patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsSessionPoolsClient) update(ctx context.Context, resourceGroupName string, sessionPoolName string, sessionPoolEnvelope SessionPoolUpdatableProperties, options *ContainerAppsSessionPoolsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsSessionPoolsClient.BeginUpdate" @@ -454,7 +453,7 @@ func (client *ContainerAppsSessionPoolsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, sessionPoolEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client_example_test.go deleted file mode 100644 index bf3bd839e0bc..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client_example_test.go +++ /dev/null @@ -1,462 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_ListBySubscription.json -func ExampleContainerAppsSessionPoolsClient_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.NewContainerAppsSessionPoolsClient().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.SessionPoolCollection = armappcontainers.SessionPoolCollection{ - // Value: []*armappcontainers.SessionPool{ - // { - // Name: to.Ptr("testsessionpool"), - // Type: to.Ptr("Microsoft.App/sessionPools"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.SessionPoolProperties{ - // ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer), - // CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{ - // Containers: []*armappcontainers.SessionContainer{ - // { - // Name: to.Ptr("testinitcontainer"), - // 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/testcontainer:v4"), - // Resources: &armappcontainers.SessionContainerResources{ - // CPU: to.Ptr[float64](0.25), - // Memory: to.Ptr("0.5Gi"), - // }, - // }}, - // Ingress: &armappcontainers.SessionIngress{ - // TargetPort: to.Ptr[int32](80), - // }, - // }, - // DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{ - // CooldownPeriodInSeconds: to.Ptr[int32](600), - // ExecutionType: to.Ptr(armappcontainers.ExecutionTypeTimed), - // }, - // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - // NodeCount: to.Ptr[int32](1), - // PoolManagementEndpoint: to.Ptr("https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"), - // PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic), - // ProvisioningState: to.Ptr(armappcontainers.SessionPoolProvisioningStateSucceeded), - // ScaleConfiguration: &armappcontainers.ScaleConfiguration{ - // MaxConcurrentSessions: to.Ptr[int32](500), - // ReadySessionInstances: to.Ptr[int32](100), - // }, - // SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{ - // Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_ListByResourceGroup.json -func ExampleContainerAppsSessionPoolsClient_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.NewContainerAppsSessionPoolsClient().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.SessionPoolCollection = armappcontainers.SessionPoolCollection{ - // Value: []*armappcontainers.SessionPool{ - // { - // Name: to.Ptr("testsessionpool"), - // Type: to.Ptr("Microsoft.App/sessionPools"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.SessionPoolProperties{ - // ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer), - // CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{ - // Containers: []*armappcontainers.SessionContainer{ - // { - // Name: to.Ptr("testinitcontainer"), - // 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/testcontainer:v4"), - // Resources: &armappcontainers.SessionContainerResources{ - // CPU: to.Ptr[float64](0.25), - // Memory: to.Ptr("0.5Gi"), - // }, - // }}, - // Ingress: &armappcontainers.SessionIngress{ - // TargetPort: to.Ptr[int32](80), - // }, - // }, - // DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{ - // CooldownPeriodInSeconds: to.Ptr[int32](600), - // ExecutionType: to.Ptr(armappcontainers.ExecutionTypeTimed), - // }, - // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - // NodeCount: to.Ptr[int32](1), - // PoolManagementEndpoint: to.Ptr("https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"), - // PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic), - // ProvisioningState: to.Ptr(armappcontainers.SessionPoolProvisioningStateSucceeded), - // ScaleConfiguration: &armappcontainers.ScaleConfiguration{ - // MaxConcurrentSessions: to.Ptr[int32](500), - // ReadySessionInstances: to.Ptr[int32](100), - // }, - // SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{ - // Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Get.json -func ExampleContainerAppsSessionPoolsClient_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.NewContainerAppsSessionPoolsClient().Get(ctx, "rg", "testsessionpool", 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.SessionPool = armappcontainers.SessionPool{ - // Name: to.Ptr("testsessionpool"), - // Type: to.Ptr("Microsoft.App/sessionPools"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.SessionPoolProperties{ - // ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer), - // CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{ - // Containers: []*armappcontainers.SessionContainer{ - // { - // Name: to.Ptr("testinitcontainer"), - // 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/testcontainer:v4"), - // Resources: &armappcontainers.SessionContainerResources{ - // CPU: to.Ptr[float64](0.25), - // Memory: to.Ptr("0.5Gi"), - // }, - // }}, - // Ingress: &armappcontainers.SessionIngress{ - // TargetPort: to.Ptr[int32](80), - // }, - // RegistryCredentials: &armappcontainers.SessionRegistryCredentials{ - // Identity: to.Ptr("/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // }, - // DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{ - // CooldownPeriodInSeconds: to.Ptr[int32](600), - // ExecutionType: to.Ptr(armappcontainers.ExecutionTypeTimed), - // }, - // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - // NodeCount: to.Ptr[int32](1), - // PoolManagementEndpoint: to.Ptr("https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"), - // PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic), - // ProvisioningState: to.Ptr(armappcontainers.SessionPoolProvisioningStateSucceeded), - // ScaleConfiguration: &armappcontainers.ScaleConfiguration{ - // MaxConcurrentSessions: to.Ptr[int32](500), - // ReadySessionInstances: to.Ptr[int32](100), - // }, - // SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{ - // Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_CreateOrUpdate.json -func ExampleContainerAppsSessionPoolsClient_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.NewContainerAppsSessionPoolsClient().BeginCreateOrUpdate(ctx, "rg", "testsessionpool", armappcontainers.SessionPool{ - Location: to.Ptr("East US"), - Properties: &armappcontainers.SessionPoolProperties{ - ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer), - CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{ - Containers: []*armappcontainers.SessionContainer{ - { - Name: to.Ptr("testinitcontainer"), - 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/testcontainer:v4"), - Resources: &armappcontainers.SessionContainerResources{ - CPU: to.Ptr[float64](0.25), - Memory: to.Ptr("0.5Gi"), - }, - }}, - Ingress: &armappcontainers.SessionIngress{ - TargetPort: to.Ptr[int32](80), - }, - }, - DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{ - CooldownPeriodInSeconds: to.Ptr[int32](600), - ExecutionType: to.Ptr(armappcontainers.ExecutionTypeTimed), - }, - EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic), - ScaleConfiguration: &armappcontainers.ScaleConfiguration{ - MaxConcurrentSessions: to.Ptr[int32](500), - ReadySessionInstances: to.Ptr[int32](100), - }, - SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{ - Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled), - }, - }, - }, 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.SessionPool = armappcontainers.SessionPool{ - // Name: to.Ptr("testsessionpool"), - // Type: to.Ptr("Microsoft.App/sessionPools"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.SessionPoolProperties{ - // ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer), - // CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{ - // Containers: []*armappcontainers.SessionContainer{ - // { - // Name: to.Ptr("testinitcontainer"), - // 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/testcontainer:v4"), - // Resources: &armappcontainers.SessionContainerResources{ - // CPU: to.Ptr[float64](0.25), - // Memory: to.Ptr("0.5Gi"), - // }, - // }}, - // Ingress: &armappcontainers.SessionIngress{ - // TargetPort: to.Ptr[int32](80), - // }, - // RegistryCredentials: &armappcontainers.SessionRegistryCredentials{ - // Identity: to.Ptr("/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"), - // Server: to.Ptr("test.azurecr.io"), - // }, - // }, - // DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{ - // CooldownPeriodInSeconds: to.Ptr[int32](600), - // ExecutionType: to.Ptr(armappcontainers.ExecutionTypeTimed), - // }, - // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - // NodeCount: to.Ptr[int32](1), - // PoolManagementEndpoint: to.Ptr("https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"), - // PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic), - // ProvisioningState: to.Ptr(armappcontainers.SessionPoolProvisioningStateSucceeded), - // ScaleConfiguration: &armappcontainers.ScaleConfiguration{ - // MaxConcurrentSessions: to.Ptr[int32](500), - // ReadySessionInstances: to.Ptr[int32](100), - // }, - // SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{ - // Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Patch.json -func ExampleContainerAppsSessionPoolsClient_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.NewContainerAppsSessionPoolsClient().BeginUpdate(ctx, "rg", "testsessionpool", armappcontainers.SessionPoolUpdatableProperties{ - Properties: &armappcontainers.SessionPoolUpdatablePropertiesProperties{ - CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{ - Containers: []*armappcontainers.SessionContainer{ - { - Name: to.Ptr("testinitcontainer"), - 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/testcontainer:v4"), - Resources: &armappcontainers.SessionContainerResources{ - CPU: to.Ptr[float64](0.25), - Memory: to.Ptr("0.5Gi"), - }, - }}, - Ingress: &armappcontainers.SessionIngress{ - TargetPort: to.Ptr[int32](80), - }, - }, - DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{ - CooldownPeriodInSeconds: to.Ptr[int32](600), - ExecutionType: to.Ptr(armappcontainers.ExecutionTypeTimed), - }, - ScaleConfiguration: &armappcontainers.ScaleConfiguration{ - MaxConcurrentSessions: to.Ptr[int32](500), - ReadySessionInstances: to.Ptr[int32](100), - }, - SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{ - Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled), - }, - }, - }, 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.SessionPool = armappcontainers.SessionPool{ - // Name: to.Ptr("testsessionpool"), - // Type: to.Ptr("Microsoft.App/sessionPools"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.SessionPoolProperties{ - // ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer), - // CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{ - // Containers: []*armappcontainers.SessionContainer{ - // { - // Name: to.Ptr("testinitcontainer"), - // 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/testcontainer:v4"), - // Resources: &armappcontainers.SessionContainerResources{ - // CPU: to.Ptr[float64](0.25), - // Memory: to.Ptr("0.5Gi"), - // }, - // }}, - // Ingress: &armappcontainers.SessionIngress{ - // TargetPort: to.Ptr[int32](80), - // }, - // }, - // DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{ - // CooldownPeriodInSeconds: to.Ptr[int32](600), - // ExecutionType: to.Ptr(armappcontainers.ExecutionTypeTimed), - // }, - // EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - // NodeCount: to.Ptr[int32](1), - // PoolManagementEndpoint: to.Ptr("https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"), - // PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic), - // ProvisioningState: to.Ptr(armappcontainers.SessionPoolProvisioningStateSucceeded), - // ScaleConfiguration: &armappcontainers.ScaleConfiguration{ - // MaxConcurrentSessions: to.Ptr[int32](500), - // ReadySessionInstances: to.Ptr[int32](100), - // }, - // SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{ - // Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Delete.json -func ExampleContainerAppsSessionPoolsClient_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.NewContainerAppsSessionPoolsClient().BeginDelete(ctx, "rg", "testsessionpool", 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) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go index e27a1e89b49b..23d215d0a4d4 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go @@ -11,15 +11,14 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "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" + "strconv" + "strings" ) // ContainerAppsSourceControlsClient contains the methods for the ContainerAppsSourceControls group. @@ -48,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -75,7 +74,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsSourceControlsClient) createOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, sourceControlEnvelope SourceControl, options *ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsSourceControlsClient.BeginCreateOrUpdate" @@ -121,7 +120,7 @@ func (client *ContainerAppsSourceControlsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.XMSGithubAuxiliary != nil { @@ -136,7 +135,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -162,7 +161,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ContainerAppsSourceControlsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerAppName string, sourceControlName string, options *ContainerAppsSourceControlsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ContainerAppsSourceControlsClient.BeginDelete" @@ -208,7 +207,7 @@ func (client *ContainerAppsSourceControlsClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") if options != nil && options.DeleteWorkflow != nil { reqQP.Set("deleteWorkflow", strconv.FormatBool(*options.DeleteWorkflow)) } @@ -226,7 +225,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -278,7 +277,7 @@ func (client *ContainerAppsSourceControlsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +294,7 @@ func (client *ContainerAppsSourceControlsClient) getHandleResponse(resp *http.Re // NewListByContainerAppPager - Get the Container App SourceControls in a given resource group. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -343,7 +342,7 @@ func (client *ContainerAppsSourceControlsClient) listByContainerAppCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-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 deleted file mode 100644 index 995b12e24d57..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client_example_test.go +++ /dev/null @@ -1,227 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_ListByContainer.json -func ExampleContainerAppsSourceControlsClient_NewListByContainerAppPager() { - 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.NewContainerAppsSourceControlsClient().NewListByContainerAppPager("workerapps-rg-xj", "testcanadacentral", 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.SourceControlCollection = armappcontainers.SourceControlCollection{ - // Value: []*armappcontainers.SourceControl{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.App/containerapps/sourcecontrols"), - // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/providers/Microsoft.App/containerApps/testcanadacentral/sourcecontrols/current"), - // Properties: &armappcontainers.SourceControlProperties{ - // Branch: to.Ptr("master"), - // GithubActionConfiguration: &armappcontainers.GithubActionConfiguration{ - // BuildEnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // ContextPath: to.Ptr("./"), - // DockerfilePath: to.Ptr("./Dockerfile"), - // Image: to.Ptr("image/tag"), - // RegistryInfo: &armappcontainers.RegistryInfo{ - // RegistryURL: to.Ptr("xwang971reg.azurecr.io"), - // RegistryUserName: to.Ptr("xwang971reg"), - // }, - // }, - // RepoURL: to.Ptr("https://github.com/xwang971/ghatest"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_Get.json -func ExampleContainerAppsSourceControlsClient_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.NewContainerAppsSourceControlsClient().Get(ctx, "workerapps-rg-xj", "testcanadacentral", "current", 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.SourceControl = armappcontainers.SourceControl{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.App/containerapps/sourcecontrols"), - // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/providers/Microsoft.App/containerApps/testcanadacentral/sourcecontrols/current"), - // Properties: &armappcontainers.SourceControlProperties{ - // Branch: to.Ptr("master"), - // GithubActionConfiguration: &armappcontainers.GithubActionConfiguration{ - // BuildEnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // ContextPath: to.Ptr("./"), - // DockerfilePath: to.Ptr("./Dockerfile"), - // Image: to.Ptr("image/tag"), - // RegistryInfo: &armappcontainers.RegistryInfo{ - // RegistryURL: to.Ptr("xwang971reg.azurecr.io"), - // RegistryUserName: to.Ptr("xwang971reg"), - // }, - // }, - // RepoURL: to.Ptr("https://github.com/xwang971/ghatest"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_CreateOrUpdate.json -func ExampleContainerAppsSourceControlsClient_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.NewContainerAppsSourceControlsClient().BeginCreateOrUpdate(ctx, "workerapps-rg-xj", "testcanadacentral", "current", armappcontainers.SourceControl{ - Properties: &armappcontainers.SourceControlProperties{ - Branch: to.Ptr("master"), - GithubActionConfiguration: &armappcontainers.GithubActionConfiguration{ - AzureCredentials: &armappcontainers.AzureCredentials{ - ClientID: to.Ptr(""), - ClientSecret: to.Ptr(""), - Kind: to.Ptr("feaderated"), - TenantID: to.Ptr(""), - }, - BuildEnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - { - Name: to.Ptr("foo1"), - Value: to.Ptr("bar1"), - }, - { - Name: to.Ptr("foo2"), - Value: to.Ptr("bar2"), - }}, - ContextPath: to.Ptr("./"), - DockerfilePath: to.Ptr("./Dockerfile"), - GithubPersonalAccessToken: to.Ptr("test"), - Image: to.Ptr("image/tag"), - RegistryInfo: &armappcontainers.RegistryInfo{ - RegistryPassword: to.Ptr(""), - RegistryURL: to.Ptr("test-registry.azurecr.io"), - RegistryUserName: to.Ptr("test-registry"), - }, - }, - RepoURL: to.Ptr("https://github.com/xwang971/ghatest"), - }, - }, &armappcontainers.ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions{XMSGithubAuxiliary: to.Ptr("githubaccesstoken")}) - 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.SourceControl = armappcontainers.SourceControl{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.App/containerapps/sourcecontrols"), - // ID: to.Ptr("/subscriptions/651f8027-33e8-4ec4-97b4-f6e9f3dc8744/resourceGroups/workerapps-rg-xj/providers/Microsoft.App/containerApps/myapp/sourcecontrols/current"), - // Properties: &armappcontainers.SourceControlProperties{ - // Branch: to.Ptr("master"), - // GithubActionConfiguration: &armappcontainers.GithubActionConfiguration{ - // BuildEnvironmentVariables: []*armappcontainers.EnvironmentVariable{ - // { - // Name: to.Ptr("foo1"), - // Value: to.Ptr("bar1"), - // }, - // { - // Name: to.Ptr("foo2"), - // Value: to.Ptr("bar2"), - // }}, - // ContextPath: to.Ptr("./"), - // Image: to.Ptr("image/tag"), - // RegistryInfo: &armappcontainers.RegistryInfo{ - // RegistryURL: to.Ptr("test-registry.azurecr.io"), - // RegistryUserName: to.Ptr("testreg"), - // }, - // }, - // OperationState: to.Ptr(armappcontainers.SourceControlOperationStateInProgress), - // RepoURL: to.Ptr("https://github.com/xwang971/ghatest"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_Delete.json -func ExampleContainerAppsSourceControlsClient_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.NewContainerAppsSourceControlsClient().BeginDelete(ctx, "workerapps-rg-xj", "testcanadacentral", "current", &armappcontainers.ContainerAppsSourceControlsClientBeginDeleteOptions{XMSGithubAuxiliary: to.Ptr("githubaccesstoken"), - IgnoreWorkflowDeletionFailure: to.Ptr(false), - DeleteWorkflow: to.Ptr(false), - }) - 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) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client.go index ab0614011f96..feb50df24c37 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // DaprComponentResiliencyPoliciesClient contains the methods for the DaprComponentResiliencyPolicies group. @@ -47,7 +46,7 @@ func NewDaprComponentResiliencyPoliciesClient(subscriptionID string, credential // CreateOrUpdate - Creates or updates a resiliency policy for a Dapr component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -105,7 +104,7 @@ func (client *DaprComponentResiliencyPoliciesClient) createOrUpdateCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, daprComponentResiliencyPolicyEnvelope); err != nil { @@ -126,7 +125,7 @@ func (client *DaprComponentResiliencyPoliciesClient) createOrUpdateHandleRespons // Delete - Delete a resiliency policy for a Dapr component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -182,7 +181,7 @@ func (client *DaprComponentResiliencyPoliciesClient) deleteCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +190,7 @@ func (client *DaprComponentResiliencyPoliciesClient) deleteCreateRequest(ctx con // Get - Get a Dapr component resiliency policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -248,7 +247,7 @@ func (client *DaprComponentResiliencyPoliciesClient) getCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +264,7 @@ func (client *DaprComponentResiliencyPoliciesClient) getHandleResponse(resp *htt // NewListPager - Get the resiliency policies for a Dapr component. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -318,7 +317,7 @@ func (client *DaprComponentResiliencyPoliciesClient) listCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client_example_test.go deleted file mode 100644 index 7f2a1dc56fa8..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client_example_test.go +++ /dev/null @@ -1,392 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_List.json -func ExampleDaprComponentResiliencyPoliciesClient_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.NewDaprComponentResiliencyPoliciesClient().NewListPager("examplerg", "myenvironment", "mydaprcomponent", 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.DaprComponentResiliencyPoliciesCollection = armappcontainers.DaprComponentResiliencyPoliciesCollection{ - // Value: []*armappcontainers.DaprComponentResiliencyPolicy{ - // { - // Name: to.Ptr("something"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprComponents/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprComponents/mydaprcomponent/resiliencyPolicies/myresiliencypolicy"), - // Properties: &armappcontainers.DaprComponentResiliencyPolicyProperties{ - // InboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - // ConsecutiveErrors: to.Ptr[int32](5), - // TimeoutInSeconds: to.Ptr[int32](10), - // }, - // HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - // MaxRetries: to.Ptr[int32](15), - // RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - // InitialDelayInMilliseconds: to.Ptr[int32](2000), - // MaxIntervalInMilliseconds: to.Ptr[int32](5500), - // }, - // }, - // TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - // ResponseTimeoutInSeconds: to.Ptr[int32](30), - // }, - // }, - // OutboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - // ConsecutiveErrors: to.Ptr[int32](3), - // IntervalInSeconds: to.Ptr[int32](60), - // TimeoutInSeconds: to.Ptr[int32](20), - // }, - // HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - // InitialDelayInMilliseconds: to.Ptr[int32](100), - // MaxIntervalInMilliseconds: to.Ptr[int32](30000), - // }, - // }, - // TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - // ResponseTimeoutInSeconds: to.Ptr[int32](12), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_Get.json -func ExampleDaprComponentResiliencyPoliciesClient_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.NewDaprComponentResiliencyPoliciesClient().Get(ctx, "examplerg", "myenvironment", "mydaprcomponent", "myresiliencypolicy", 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.DaprComponentResiliencyPolicy = armappcontainers.DaprComponentResiliencyPolicy{ - // Name: to.Ptr("myresiliencypolicy"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprComponents/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprComponents/mydaprcomponent/resiliencyPolicies/myresiliencypolicy"), - // Properties: &armappcontainers.DaprComponentResiliencyPolicyProperties{ - // InboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - // ConsecutiveErrors: to.Ptr[int32](5), - // TimeoutInSeconds: to.Ptr[int32](10), - // }, - // HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - // MaxRetries: to.Ptr[int32](15), - // RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - // InitialDelayInMilliseconds: to.Ptr[int32](2000), - // MaxIntervalInMilliseconds: to.Ptr[int32](5500), - // }, - // }, - // TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - // ResponseTimeoutInSeconds: to.Ptr[int32](30), - // }, - // }, - // OutboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - // ConsecutiveErrors: to.Ptr[int32](3), - // IntervalInSeconds: to.Ptr[int32](60), - // TimeoutInSeconds: to.Ptr[int32](20), - // }, - // HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - // InitialDelayInMilliseconds: to.Ptr[int32](100), - // MaxIntervalInMilliseconds: to.Ptr[int32](30000), - // }, - // }, - // TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - // ResponseTimeoutInSeconds: to.Ptr[int32](12), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_AllOptions.json -func ExampleDaprComponentResiliencyPoliciesClient_CreateOrUpdate_createOrUpdateDaprComponentResiliencyPolicyWithAllOptions() { - 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.NewDaprComponentResiliencyPoliciesClient().CreateOrUpdate(ctx, "examplerg", "myenvironment", "mydaprcomponent", "myresiliencypolicy", armappcontainers.DaprComponentResiliencyPolicy{ - Properties: &armappcontainers.DaprComponentResiliencyPolicyProperties{ - InboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - ConsecutiveErrors: to.Ptr[int32](5), - IntervalInSeconds: to.Ptr[int32](4), - TimeoutInSeconds: to.Ptr[int32](10), - }, - HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - MaxRetries: to.Ptr[int32](15), - RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - InitialDelayInMilliseconds: to.Ptr[int32](2000), - MaxIntervalInMilliseconds: to.Ptr[int32](5500), - }, - }, - TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - ResponseTimeoutInSeconds: to.Ptr[int32](30), - }, - }, - OutboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - ConsecutiveErrors: to.Ptr[int32](3), - IntervalInSeconds: to.Ptr[int32](60), - TimeoutInSeconds: to.Ptr[int32](20), - }, - HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - MaxRetries: to.Ptr[int32](5), - RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - InitialDelayInMilliseconds: to.Ptr[int32](100), - MaxIntervalInMilliseconds: to.Ptr[int32](30000), - }, - }, - TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - ResponseTimeoutInSeconds: to.Ptr[int32](12), - }, - }, - }, - }, 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.DaprComponentResiliencyPolicy = armappcontainers.DaprComponentResiliencyPolicy{ - // Name: to.Ptr("myresiliencypolicy"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprComponents/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprComponents/mydaprcomponent/resiliencyPolicies/myresiliencypolicy"), - // Properties: &armappcontainers.DaprComponentResiliencyPolicyProperties{ - // InboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - // ConsecutiveErrors: to.Ptr[int32](5), - // IntervalInSeconds: to.Ptr[int32](4), - // TimeoutInSeconds: to.Ptr[int32](10), - // }, - // HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - // MaxRetries: to.Ptr[int32](15), - // RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - // InitialDelayInMilliseconds: to.Ptr[int32](2000), - // MaxIntervalInMilliseconds: to.Ptr[int32](5500), - // }, - // }, - // TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - // ResponseTimeoutInSeconds: to.Ptr[int32](30), - // }, - // }, - // OutboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - // ConsecutiveErrors: to.Ptr[int32](3), - // IntervalInSeconds: to.Ptr[int32](60), - // TimeoutInSeconds: to.Ptr[int32](20), - // }, - // HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - // InitialDelayInMilliseconds: to.Ptr[int32](100), - // MaxIntervalInMilliseconds: to.Ptr[int32](30000), - // }, - // }, - // TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - // ResponseTimeoutInSeconds: to.Ptr[int32](12), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_OutboundOnly.json -func ExampleDaprComponentResiliencyPoliciesClient_CreateOrUpdate_createOrUpdateDaprComponentResiliencyPolicyWithOutboundPolicyOnly() { - 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.NewDaprComponentResiliencyPoliciesClient().CreateOrUpdate(ctx, "examplerg", "myenvironment", "mydaprcomponent", "myresiliencypolicy", armappcontainers.DaprComponentResiliencyPolicy{ - Properties: &armappcontainers.DaprComponentResiliencyPolicyProperties{ - OutboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - ConsecutiveErrors: to.Ptr[int32](3), - IntervalInSeconds: to.Ptr[int32](60), - TimeoutInSeconds: to.Ptr[int32](20), - }, - HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - MaxRetries: to.Ptr[int32](5), - RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - InitialDelayInMilliseconds: to.Ptr[int32](100), - MaxIntervalInMilliseconds: to.Ptr[int32](30000), - }, - }, - TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - ResponseTimeoutInSeconds: to.Ptr[int32](12), - }, - }, - }, - }, 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.DaprComponentResiliencyPolicy = armappcontainers.DaprComponentResiliencyPolicy{ - // Name: to.Ptr("myresiliencypolicy"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprComponents/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprComponents/mydaprcomponent/resiliencyPolicies/myresiliencypolicy"), - // Properties: &armappcontainers.DaprComponentResiliencyPolicyProperties{ - // OutboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - // ConsecutiveErrors: to.Ptr[int32](3), - // IntervalInSeconds: to.Ptr[int32](60), - // TimeoutInSeconds: to.Ptr[int32](20), - // }, - // HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - // InitialDelayInMilliseconds: to.Ptr[int32](100), - // MaxIntervalInMilliseconds: to.Ptr[int32](30000), - // }, - // }, - // TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - // ResponseTimeoutInSeconds: to.Ptr[int32](12), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_SparseOptions.json -func ExampleDaprComponentResiliencyPoliciesClient_CreateOrUpdate_createOrUpdateDaprComponentResiliencyPolicyWithSparseOptions() { - 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.NewDaprComponentResiliencyPoliciesClient().CreateOrUpdate(ctx, "examplerg", "myenvironment", "mydaprcomponent", "myresiliencypolicy", armappcontainers.DaprComponentResiliencyPolicy{ - Properties: &armappcontainers.DaprComponentResiliencyPolicyProperties{ - InboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - ConsecutiveErrors: to.Ptr[int32](3), - TimeoutInSeconds: to.Ptr[int32](20), - }, - HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - MaxRetries: to.Ptr[int32](5), - RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - InitialDelayInMilliseconds: to.Ptr[int32](2000), - MaxIntervalInMilliseconds: to.Ptr[int32](5500), - }, - }, - }, - OutboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - ResponseTimeoutInSeconds: to.Ptr[int32](12), - }, - }, - }, - }, 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.DaprComponentResiliencyPolicy = armappcontainers.DaprComponentResiliencyPolicy{ - // Name: to.Ptr("myresiliencypolicy"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprComponents/resiliencyPolicies"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprComponents/mydaprcomponent/resiliencyPolicies/myresiliencypolicy"), - // Properties: &armappcontainers.DaprComponentResiliencyPolicyProperties{ - // InboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // CircuitBreakerPolicy: &armappcontainers.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration{ - // ConsecutiveErrors: to.Ptr[int32](3), - // TimeoutInSeconds: to.Ptr[int32](20), - // }, - // HTTPRetryPolicy: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration{ - // MaxRetries: to.Ptr[int32](5), - // RetryBackOff: &armappcontainers.DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration{ - // InitialDelayInMilliseconds: to.Ptr[int32](2000), - // MaxIntervalInMilliseconds: to.Ptr[int32](5500), - // }, - // }, - // }, - // OutboundPolicy: &armappcontainers.DaprComponentResiliencyPolicyConfiguration{ - // TimeoutPolicy: &armappcontainers.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration{ - // ResponseTimeoutInSeconds: to.Ptr[int32](12), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_Delete.json -func ExampleDaprComponentResiliencyPoliciesClient_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.NewDaprComponentResiliencyPoliciesClient().Delete(ctx, "examplerg", "myenvironment", "mydaprcomponent", "myresiliencypolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go index f905bf710a44..54a68473d003 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // DaprComponentsClient contains the methods for the DaprComponents group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -100,7 +99,7 @@ func (client *DaprComponentsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, daprComponentEnvelope); err != nil { @@ -121,7 +120,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -171,7 +170,7 @@ func (client *DaprComponentsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +179,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -231,7 +230,7 @@ func (client *DaprComponentsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +247,7 @@ func (client *DaprComponentsClient) getHandleResponse(resp *http.Response) (Dapr // NewListPager - Get the Dapr Components for a managed environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -295,7 +294,7 @@ func (client *DaprComponentsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,7 +312,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -365,7 +364,7 @@ func (client *DaprComponentsClient) listSecretsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-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 deleted file mode 100644 index a2492bb02922..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client_example_test.go +++ /dev/null @@ -1,547 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_List.json -func ExampleDaprComponentsClient_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.NewDaprComponentsClient().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/managedEnvironments/daprcomponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/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"), - // }}, - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // 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"), - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // 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"), - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // Version: to.Ptr("v1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // Version: to.Ptr("v1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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) - } - 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")}, - // Secrets: []*armappcontainers.Secret{ - // { - // Name: to.Ptr("masterkey"), - // }}, - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // Version: to.Ptr("v1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - { - Name: to.Ptr("statestore"), - Metadata: &armappcontainers.DaprServiceBindMetadata{ - Name: to.Ptr("daprcomponentBind"), - Value: to.Ptr("redis-bind"), - }, - ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - }}, - 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"), - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // Version: to.Ptr("v1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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) - } - 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")}, - Secrets: []*armappcontainers.Secret{ - { - Name: to.Ptr("masterkey"), - Value: to.Ptr("keyvalue"), - }}, - ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - { - Name: to.Ptr("statestore"), - Metadata: &armappcontainers.DaprServiceBindMetadata{ - Name: to.Ptr("daprcomponentBind"), - Value: to.Ptr("redis-bind"), - }, - ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - }}, - 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")}, - // Secrets: []*armappcontainers.Secret{ - // { - // Name: to.Ptr("masterkey"), - // }}, - // ServiceComponentBind: []*armappcontainers.DaprComponentServiceBinding{ - // { - // Name: to.Ptr("statestore"), - // Metadata: &armappcontainers.DaprServiceBindMetadata{ - // Name: to.Ptr("daprcomponentBind"), - // Value: to.Ptr("redis-bind"), - // }, - // ServiceID: to.Ptr("/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis"), - // }}, - // Version: to.Ptr("v1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_Delete.json -func ExampleDaprComponentsClient_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.NewDaprComponentsClient().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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_ListSecrets.json -func ExampleDaprComponentsClient_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.NewDaprComponentsClient().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"), - // }, - // { - // Name: to.Ptr("secret2"), - // }}, - // } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client.go index 49eb6d46fb81..4008fca5bb2f 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // DaprSubscriptionsClient contains the methods for the DaprSubscriptions group. @@ -47,7 +46,7 @@ func NewDaprSubscriptionsClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates or updates a Dapr subscription in a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the Dapr subscription. @@ -100,7 +99,7 @@ func (client *DaprSubscriptionsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, daprSubscriptionEnvelope); err != nil { @@ -121,7 +120,7 @@ func (client *DaprSubscriptionsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Delete a Dapr subscription from a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the Dapr subscription. @@ -172,7 +171,7 @@ func (client *DaprSubscriptionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +180,7 @@ func (client *DaprSubscriptionsClient) deleteCreateRequest(ctx context.Context, // Get - Get a dapr subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the Dapr subscription. @@ -232,7 +231,7 @@ func (client *DaprSubscriptionsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +248,7 @@ func (client *DaprSubscriptionsClient) getHandleResponse(resp *http.Response) (D // NewListPager - Get the Dapr subscriptions for a managed environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - options - DaprSubscriptionsClientListOptions contains the optional parameters for the DaprSubscriptionsClient.NewListPager @@ -297,7 +296,7 @@ func (client *DaprSubscriptionsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client_example_test.go deleted file mode 100644 index d239bcd2578d..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client_example_test.go +++ /dev/null @@ -1,409 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_List.json -func ExampleDaprSubscriptionsClient_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.NewDaprSubscriptionsClient().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.DaprSubscriptionsCollection = armappcontainers.DaprSubscriptionsCollection{ - // Value: []*armappcontainers.DaprSubscription{ - // { - // Name: to.Ptr("mybulksubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/mybulksubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // BulkSubscribe: &armappcontainers.DaprSubscriptionBulkSubscribeOptions{ - // Enabled: to.Ptr(true), - // MaxAwaitDurationMs: to.Ptr[int32](500), - // MaxMessagesCount: to.Ptr[int32](123), - // }, - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // }, - // }, - // Topic: to.Ptr("inventory"), - // }, - // }, - // { - // Name: to.Ptr("mydefaultsubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/mydefaultsubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // }, - // }, - // Topic: to.Ptr("inventory"), - // }, - // }, - // { - // Name: to.Ptr("myroutingsubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/myroutingsubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // Metadata: map[string]*string{ - // "foo": to.Ptr("bar"), - // "hello": to.Ptr("world"), - // }, - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // { - // Path: to.Ptr("/widgets"), - // Match: to.Ptr("event.type == 'widget'"), - // }, - // { - // Path: to.Ptr("/gadgets"), - // Match: to.Ptr("event.type == 'gadget'"), - // }}, - // }, - // Topic: to.Ptr("inventory"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_DefaultRoute.json -func ExampleDaprSubscriptionsClient_Get_getDaprSubscriptionWithBulkSubscribeConfigurationAndScopes() { - 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.NewDaprSubscriptionsClient().Get(ctx, "examplerg", "myenvironment", "mypubsubcomponent", 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.DaprSubscription = armappcontainers.DaprSubscription{ - // Name: to.Ptr("mysubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/mysubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // }, - // }, - // Topic: to.Ptr("inventory"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_BulkSubscribeAndScopes.json -func ExampleDaprSubscriptionsClient_Get_getDaprSubscriptionWithDefaultRouteOnly() { - 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.NewDaprSubscriptionsClient().Get(ctx, "examplerg", "myenvironment", "mypubsubcomponent", 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.DaprSubscription = armappcontainers.DaprSubscription{ - // Name: to.Ptr("mysubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/mysubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // BulkSubscribe: &armappcontainers.DaprSubscriptionBulkSubscribeOptions{ - // Enabled: to.Ptr(true), - // MaxAwaitDurationMs: to.Ptr[int32](500), - // MaxMessagesCount: to.Ptr[int32](123), - // }, - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // }, - // }, - // Scopes: []*string{ - // to.Ptr("warehouseapp"), - // to.Ptr("customersupportapp")}, - // Topic: to.Ptr("inventory"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_RouteRulesAndMetadata.json -func ExampleDaprSubscriptionsClient_Get_getDaprSubscriptionWithRouteRulesAndMetadata() { - 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.NewDaprSubscriptionsClient().Get(ctx, "examplerg", "myenvironment", "mypubsubcomponent", 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.DaprSubscription = armappcontainers.DaprSubscription{ - // Name: to.Ptr("mysubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/mysubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // Metadata: map[string]*string{ - // "foo": to.Ptr("bar"), - // "hello": to.Ptr("world"), - // }, - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // { - // Path: to.Ptr("/widgets"), - // Match: to.Ptr("event.type == 'widget'"), - // }, - // { - // Path: to.Ptr("/gadgets"), - // Match: to.Ptr("event.type == 'gadget'"), - // }}, - // }, - // Topic: to.Ptr("inventory"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_BulkSubscribeAndScopes.json -func ExampleDaprSubscriptionsClient_CreateOrUpdate_createOrUpdateDaprSubscriptionWithBulkSubscribeConfigurationAndScopes() { - 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.NewDaprSubscriptionsClient().CreateOrUpdate(ctx, "examplerg", "myenvironment", "mysubscription", armappcontainers.DaprSubscription{ - Properties: &armappcontainers.DaprSubscriptionProperties{ - BulkSubscribe: &armappcontainers.DaprSubscriptionBulkSubscribeOptions{ - Enabled: to.Ptr(true), - MaxAwaitDurationMs: to.Ptr[int32](500), - MaxMessagesCount: to.Ptr[int32](123), - }, - PubsubName: to.Ptr("mypubsubcomponent"), - Routes: &armappcontainers.DaprSubscriptionRoutes{ - Default: to.Ptr("/products"), - }, - Scopes: []*string{ - to.Ptr("warehouseapp"), - to.Ptr("customersupportapp")}, - Topic: to.Ptr("inventory"), - }, - }, 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.DaprSubscription = armappcontainers.DaprSubscription{ - // Name: to.Ptr("mysubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/mysubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // BulkSubscribe: &armappcontainers.DaprSubscriptionBulkSubscribeOptions{ - // Enabled: to.Ptr(true), - // MaxAwaitDurationMs: to.Ptr[int32](500), - // MaxMessagesCount: to.Ptr[int32](123), - // }, - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // }, - // }, - // Scopes: []*string{ - // to.Ptr("warehouseapp"), - // to.Ptr("customersupportapp")}, - // Topic: to.Ptr("inventory"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_DefaultRoute.json -func ExampleDaprSubscriptionsClient_CreateOrUpdate_createOrUpdateDaprSubscriptionWithDefaultRouteOnly() { - 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.NewDaprSubscriptionsClient().CreateOrUpdate(ctx, "examplerg", "myenvironment", "mysubscription", armappcontainers.DaprSubscription{ - Properties: &armappcontainers.DaprSubscriptionProperties{ - PubsubName: to.Ptr("mypubsubcomponent"), - Routes: &armappcontainers.DaprSubscriptionRoutes{ - Default: to.Ptr("/products"), - }, - Topic: to.Ptr("inventory"), - }, - }, 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.DaprSubscription = armappcontainers.DaprSubscription{ - // Name: to.Ptr("mysubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/mysubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // }, - // }, - // Topic: to.Ptr("inventory"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_RouteRulesAndMetadata.json -func ExampleDaprSubscriptionsClient_CreateOrUpdate_createOrUpdateDaprSubscriptionWithRouteRulesAndMetadata() { - 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.NewDaprSubscriptionsClient().CreateOrUpdate(ctx, "examplerg", "myenvironment", "mysubscription", armappcontainers.DaprSubscription{ - Properties: &armappcontainers.DaprSubscriptionProperties{ - Metadata: map[string]*string{ - "foo": to.Ptr("bar"), - "hello": to.Ptr("world"), - }, - PubsubName: to.Ptr("mypubsubcomponent"), - Routes: &armappcontainers.DaprSubscriptionRoutes{ - Default: to.Ptr("/products"), - Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - { - Path: to.Ptr("/widgets"), - Match: to.Ptr("event.type == 'widget'"), - }, - { - Path: to.Ptr("/gadgets"), - Match: to.Ptr("event.type == 'gadget'"), - }}, - }, - Topic: to.Ptr("inventory"), - }, - }, 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.DaprSubscription = armappcontainers.DaprSubscription{ - // Name: to.Ptr("mysubscription"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/daprSubscriptions"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/daprSubscriptions/mysubscription"), - // Properties: &armappcontainers.DaprSubscriptionProperties{ - // Metadata: map[string]*string{ - // "foo": to.Ptr("bar"), - // "hello": to.Ptr("world"), - // }, - // PubsubName: to.Ptr("mypubsubcomponent"), - // Routes: &armappcontainers.DaprSubscriptionRoutes{ - // Default: to.Ptr("/products"), - // Rules: []*armappcontainers.DaprSubscriptionRouteRule{ - // { - // Path: to.Ptr("/widgets"), - // Match: to.Ptr("event.type == 'widget'"), - // }, - // { - // Path: to.Ptr("/gadgets"), - // Match: to.Ptr("event.type == 'gadget'"), - // }}, - // }, - // Topic: to.Ptr("inventory"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Delete.json -func ExampleDaprSubscriptionsClient_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.NewDaprSubscriptionsClient().Delete(ctx, "examplerg", "myenvironment", "mysubscription", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client.go index 60bc84ac5f2a..c51f3e1db35a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // DotNetComponentsClient contains the methods for the DotNetComponents group. @@ -47,7 +46,7 @@ func NewDotNetComponentsClient(subscriptionID string, credential azcore.TokenCre // BeginCreateOrUpdate - Creates or updates a .NET Component in a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the .NET Component. @@ -75,7 +74,7 @@ func (client *DotNetComponentsClient) BeginCreateOrUpdate(ctx context.Context, r // CreateOrUpdate - Creates or updates a .NET Component in a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *DotNetComponentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, name string, dotNetComponentEnvelope DotNetComponent, options *DotNetComponentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DotNetComponentsClient.BeginCreateOrUpdate" @@ -121,7 +120,7 @@ func (client *DotNetComponentsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, dotNetComponentEnvelope); err != nil { @@ -133,7 +132,7 @@ func (client *DotNetComponentsClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - Delete a .NET Component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the .NET Component. @@ -160,7 +159,7 @@ func (client *DotNetComponentsClient) BeginDelete(ctx context.Context, resourceG // Delete - Delete a .NET Component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *DotNetComponentsClient) deleteOperation(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DotNetComponentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DotNetComponentsClient.BeginDelete" @@ -206,7 +205,7 @@ func (client *DotNetComponentsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +214,7 @@ func (client *DotNetComponentsClient) deleteCreateRequest(ctx context.Context, r // Get - Get a .NET Component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the .NET Component. @@ -266,7 +265,7 @@ func (client *DotNetComponentsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +282,7 @@ func (client *DotNetComponentsClient) getHandleResponse(resp *http.Response) (Do // NewListPager - Get the .NET Components for a managed environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - options - DotNetComponentsClientListOptions contains the optional parameters for the DotNetComponentsClient.NewListPager @@ -331,7 +330,7 @@ func (client *DotNetComponentsClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +348,7 @@ func (client *DotNetComponentsClient) listHandleResponse(resp *http.Response) (D // BeginUpdate - Patches a .NET Component using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the .NET Component. @@ -376,7 +375,7 @@ func (client *DotNetComponentsClient) BeginUpdate(ctx context.Context, resourceG // Update - Patches a .NET Component using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *DotNetComponentsClient) update(ctx context.Context, resourceGroupName string, environmentName string, name string, dotNetComponentEnvelope DotNetComponent, options *DotNetComponentsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DotNetComponentsClient.BeginUpdate" @@ -422,7 +421,7 @@ func (client *DotNetComponentsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, dotNetComponentEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client_example_test.go deleted file mode 100644 index 5feaf78c731a..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client_example_test.go +++ /dev/null @@ -1,443 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_List.json -func ExampleDotNetComponentsClient_NewListPager_listNetComponents() { - 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.NewDotNetComponentsClient().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.DotNetComponentsCollection = armappcontainers.DotNetComponentsCollection{ - // Value: []*armappcontainers.DotNetComponent{ - // { - // Name: to.Ptr("blueshark"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/blueshark"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("dashboard-theme"), - // Value: to.Ptr("dark"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("yellowcat"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentType("MyOtherDotNetComponentType")), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("timeout-value"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_List_ServiceBind.json -func ExampleDotNetComponentsClient_NewListPager_listNetComponentsWithServiceBinds() { - 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.NewDotNetComponentsClient().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.DotNetComponentsCollection = armappcontainers.DotNetComponentsCollection{ - // Value: []*armappcontainers.DotNetComponent{ - // { - // Name: to.Ptr("blueshark"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/blueshark"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("dashboard-theme"), - // Value: to.Ptr("dark"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // ServiceBinds: []*armappcontainers.DotNetComponentServiceBind{ - // { - // Name: to.Ptr("yellowcat"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("yellowcat"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentType("MyOtherDotNetComponentType")), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("timeout-value"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // ServiceBinds: []*armappcontainers.DotNetComponentServiceBind{ - // { - // Name: to.Ptr("blueshark"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/blueshark"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Get.json -func ExampleDotNetComponentsClient_Get_getNetComponent() { - 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.NewDotNetComponentsClient().Get(ctx, "examplerg", "myenvironment", "mydotnetcomponent", 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.DotNetComponent = armappcontainers.DotNetComponent{ - // Name: to.Ptr("mydotnetcomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/mydotnetcomponent"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("dashboard-theme"), - // Value: to.Ptr("dark"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Get_ServiceBind.json -func ExampleDotNetComponentsClient_Get_getNetComponentWithServiceBinds() { - 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.NewDotNetComponentsClient().Get(ctx, "examplerg", "myenvironment", "mydotnetcomponent", 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.DotNetComponent = armappcontainers.DotNetComponent{ - // Name: to.Ptr("mydotnetcomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/mydotnetcomponent"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("dashboard-theme"), - // Value: to.Ptr("dark"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // ServiceBinds: []*armappcontainers.DotNetComponentServiceBind{ - // { - // Name: to.Ptr("yellowcat"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_CreateOrUpdate.json -func ExampleDotNetComponentsClient_BeginCreateOrUpdate_createOrUpdateNetComponent() { - 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.NewDotNetComponentsClient().BeginCreateOrUpdate(ctx, "examplerg", "myenvironment", "mydotnetcomponent", armappcontainers.DotNetComponent{ - Properties: &armappcontainers.DotNetComponentProperties{ - ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - { - PropertyName: to.Ptr("dashboard-theme"), - Value: to.Ptr("dark"), - }}, - }, - }, 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.DotNetComponent = armappcontainers.DotNetComponent{ - // Name: to.Ptr("mydotnetcomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/mydotnetcomponent"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("dashboard-theme"), - // Value: to.Ptr("dark"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_CreateOrUpdate_ServiceBind.json -func ExampleDotNetComponentsClient_BeginCreateOrUpdate_createOrUpdateNetComponentWithServiceBinds() { - 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.NewDotNetComponentsClient().BeginCreateOrUpdate(ctx, "examplerg", "myenvironment", "mydotnetcomponent", armappcontainers.DotNetComponent{ - Properties: &armappcontainers.DotNetComponentProperties{ - ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - { - PropertyName: to.Ptr("dashboard-theme"), - Value: to.Ptr("dark"), - }}, - ServiceBinds: []*armappcontainers.DotNetComponentServiceBind{ - { - Name: to.Ptr("yellowcat"), - ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat"), - }}, - }, - }, 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.DotNetComponent = armappcontainers.DotNetComponent{ - // Name: to.Ptr("mydotnetcomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/mydotnetcomponent"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("dashboard-theme"), - // Value: to.Ptr("dark"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // ServiceBinds: []*armappcontainers.DotNetComponentServiceBind{ - // { - // Name: to.Ptr("yellowcat"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Patch.json -func ExampleDotNetComponentsClient_BeginUpdate_patchNetComponent() { - 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.NewDotNetComponentsClient().BeginUpdate(ctx, "examplerg", "myenvironment", "mydotnetcomponent", armappcontainers.DotNetComponent{ - Properties: &armappcontainers.DotNetComponentProperties{ - ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - { - PropertyName: to.Ptr("dashboard-theme"), - Value: to.Ptr("dark"), - }}, - }, - }, 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.DotNetComponent = armappcontainers.DotNetComponent{ - // Name: to.Ptr("mydotnetcomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/mydotnetcomponent"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("dashboard-theme"), - // Value: to.Ptr("dark"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Patch_ServiceBind.json -func ExampleDotNetComponentsClient_BeginUpdate_patchNetComponentWithServiceBinds() { - 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.NewDotNetComponentsClient().BeginUpdate(ctx, "examplerg", "myenvironment", "mydotnetcomponent", armappcontainers.DotNetComponent{ - Properties: &armappcontainers.DotNetComponentProperties{ - ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - { - PropertyName: to.Ptr("dashboard-theme"), - Value: to.Ptr("dark"), - }}, - ServiceBinds: []*armappcontainers.DotNetComponentServiceBind{ - { - Name: to.Ptr("yellowcat"), - ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat"), - }}, - }, - }, 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.DotNetComponent = armappcontainers.DotNetComponent{ - // Name: to.Ptr("mydotnetcomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/dotNetComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/mydotnetcomponent"), - // Properties: &armappcontainers.DotNetComponentProperties{ - // ComponentType: to.Ptr(armappcontainers.DotNetComponentTypeAspireDashboard), - // Configurations: []*armappcontainers.DotNetComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("dashboard-theme"), - // Value: to.Ptr("dark"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.DotNetComponentProvisioningStateSucceeded), - // ServiceBinds: []*armappcontainers.DotNetComponentServiceBind{ - // { - // Name: to.Ptr("yellowcat"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Delete.json -func ExampleDotNetComponentsClient_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.NewDotNetComponentsClient().BeginDelete(ctx, "examplerg", "myenvironment", "mydotnetcomponent", 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) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/appresiliency_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/appresiliency_server.go index 3261255adf8a..2f080b2c2703 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/appresiliency_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/appresiliency_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // AppResiliencyServer is a fake server for instances of the armappcontainers.AppResiliencyClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/availableworkloadprofiles_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/availableworkloadprofiles_server.go index b7e4276be2dd..97e136b55c89 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/availableworkloadprofiles_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/availableworkloadprofiles_server.go @@ -11,15 +11,14 @@ package fake import ( "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // AvailableWorkloadProfilesServer is a fake server for instances of the armappcontainers.AvailableWorkloadProfilesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/billingmeters_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/billingmeters_server.go index 3ec8c1e13e1c..c4043b639598 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/billingmeters_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/billingmeters_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // BillingMetersServer is a fake server for instances of the armappcontainers.BillingMetersClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildauthtoken_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildauthtoken_server.go index b78b5f9711eb..60ef63e71e48 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildauthtoken_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildauthtoken_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // BuildAuthTokenServer is a fake server for instances of the armappcontainers.BuildAuthTokenClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/builders_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/builders_server.go index b87d6ed74f4d..699a71603f3a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/builders_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/builders_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // BuildersServer is a fake server for instances of the armappcontainers.BuildersClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/builds_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/builds_server.go index ca8cf5a38458..3c95b586e9ea 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/builds_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/builds_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // BuildsServer is a fake server for instances of the armappcontainers.BuildsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildsbybuilderresource_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildsbybuilderresource_server.go index abe6a8fd072d..1611fc338a4c 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildsbybuilderresource_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildsbybuilderresource_server.go @@ -11,15 +11,14 @@ package fake import ( "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // BuildsByBuilderResourceServer is a fake server for instances of the armappcontainers.BuildsByBuilderResourceClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/certificates_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/certificates_server.go index 3ca540fff52d..bf03f93f8f88 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/certificates_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/certificates_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "reflect" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "reflect" + "regexp" ) // CertificatesServer is a fake server for instances of the armappcontainers.CertificatesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironments_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironments_server.go index 3502eb18a3d4..0373828e415a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironments_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironments_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ConnectedEnvironmentsServer is a fake server for instances of the armappcontainers.ConnectedEnvironmentsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentscertificates_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentscertificates_server.go index 8d6c858ff015..a2087fc4b255 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentscertificates_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentscertificates_server.go @@ -12,27 +12,26 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "reflect" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "reflect" + "regexp" ) // ConnectedEnvironmentsCertificatesServer is a fake server for instances of the armappcontainers.ConnectedEnvironmentsCertificatesClient type. type ConnectedEnvironmentsCertificatesServer struct { - // CreateOrUpdate is the fake for method ConnectedEnvironmentsCertificatesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *armappcontainers.ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method ConnectedEnvironmentsCertificatesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *armappcontainers.ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - // Delete is the fake for method ConnectedEnvironmentsCertificatesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *armappcontainers.ConnectedEnvironmentsCertificatesClientDeleteOptions) (resp azfake.Responder[armappcontainers.ConnectedEnvironmentsCertificatesClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method ConnectedEnvironmentsCertificatesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, options *armappcontainers.ConnectedEnvironmentsCertificatesClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ConnectedEnvironmentsCertificatesClient.Get // HTTP status codes to indicate success: http.StatusOK @@ -42,9 +41,9 @@ type ConnectedEnvironmentsCertificatesServer struct { // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, connectedEnvironmentName string, options *armappcontainers.ConnectedEnvironmentsCertificatesClientListOptions) (resp azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientListResponse]) - // Update is the fake for method ConnectedEnvironmentsCertificatesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope armappcontainers.CertificatePatch, options *armappcontainers.ConnectedEnvironmentsCertificatesClientUpdateOptions) (resp azfake.Responder[armappcontainers.ConnectedEnvironmentsCertificatesClientUpdateResponse], errResp azfake.ErrorResponder) + // BeginUpdate is the fake for method ConnectedEnvironmentsCertificatesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, certificateName string, certificateEnvelope armappcontainers.CertificatePatch, options *armappcontainers.ConnectedEnvironmentsCertificatesClientBeginUpdateOptions) (resp azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewConnectedEnvironmentsCertificatesServerTransport creates a new instance of ConnectedEnvironmentsCertificatesServerTransport with the provided implementation. @@ -52,16 +51,22 @@ type ConnectedEnvironmentsCertificatesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewConnectedEnvironmentsCertificatesServerTransport(srv *ConnectedEnvironmentsCertificatesServer) *ConnectedEnvironmentsCertificatesServerTransport { return &ConnectedEnvironmentsCertificatesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientListResponse]](), + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientUpdateResponse]](), } } // ConnectedEnvironmentsCertificatesServerTransport connects instances of armappcontainers.ConnectedEnvironmentsCertificatesClient to instances of ConnectedEnvironmentsCertificatesServer. // Don't use this type directly, use NewConnectedEnvironmentsCertificatesServerTransport instead. type ConnectedEnvironmentsCertificatesServerTransport struct { - srv *ConnectedEnvironmentsCertificatesServer - newListPager *tracker[azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientListResponse]] + srv *ConnectedEnvironmentsCertificatesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsCertificatesClientUpdateResponse]] } // Do implements the policy.Transporter interface for ConnectedEnvironmentsCertificatesServerTransport. @@ -76,16 +81,16 @@ func (c *ConnectedEnvironmentsCertificatesServerTransport) Do(req *http.Request) var err error switch method { - case "ConnectedEnvironmentsCertificatesClient.CreateOrUpdate": - resp, err = c.dispatchCreateOrUpdate(req) - case "ConnectedEnvironmentsCertificatesClient.Delete": - resp, err = c.dispatchDelete(req) + case "ConnectedEnvironmentsCertificatesClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "ConnectedEnvironmentsCertificatesClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) case "ConnectedEnvironmentsCertificatesClient.Get": resp, err = c.dispatchGet(req) case "ConnectedEnvironmentsCertificatesClient.NewListPager": resp, err = c.dispatchNewListPager(req) - case "ConnectedEnvironmentsCertificatesClient.Update": - resp, err = c.dispatchUpdate(req) + case "ConnectedEnvironmentsCertificatesClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -97,87 +102,109 @@ func (c *ConnectedEnvironmentsCertificatesServerTransport) Do(req *http.Request) return resp, nil } -func (c *ConnectedEnvironmentsCertificatesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if c.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armappcontainers.Certificate](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err +func (c *ConnectedEnvironmentsCertificatesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} } - connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) - if err != nil { - return nil, err + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.Certificate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) + if err != nil { + return nil, err + } + certificateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("certificateName")]) + if err != nil { + return nil, err + } + var options *armappcontainers.ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armappcontainers.ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions{ + CertificateEnvelope: &body, + } + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, certificateNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) } - certificateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("certificateName")]) + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) if err != nil { return nil, err } - var options *armappcontainers.ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armappcontainers.ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions{ - CertificateEnvelope: &body, - } - } - respr, errRespr := c.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, certificateNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Certificate, req) - if err != nil { - return nil, err + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) } + return resp, nil } -func (c *ConnectedEnvironmentsCertificatesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if c.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) +func (c *ConnectedEnvironmentsCertificatesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) - if err != nil { - return nil, err + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) + if err != nil { + return nil, err + } + certificateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("certificateName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, certificateNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) } - certificateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("certificateName")]) + + resp, err := server.PollerResponderNext(beginDelete, req) if err != nil { return nil, err } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, certificateNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) } + return resp, nil } @@ -259,43 +286,54 @@ func (c *ConnectedEnvironmentsCertificatesServerTransport) dispatchNewListPager( return resp, nil } -func (c *ConnectedEnvironmentsCertificatesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if c.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armappcontainers.CertificatePatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err +func (c *ConnectedEnvironmentsCertificatesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} } - connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) - if err != nil { - return nil, err + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.CertificatePatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) + if err != nil { + return nil, err + } + certificateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("certificateName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, certificateNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) } - certificateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("certificateName")]) + + resp, err := server.PollerResponderNext(beginUpdate, req) if err != nil { return nil, err } - respr, errRespr := c.srv.Update(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, certificateNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Certificate, req) - if err != nil { - return nil, err + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) } + return resp, nil } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsdaprcomponents_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsdaprcomponents_server.go index 26fa054b179f..275bb0d610bd 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsdaprcomponents_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsdaprcomponents_server.go @@ -12,26 +12,25 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ConnectedEnvironmentsDaprComponentsServer is a fake server for instances of the armappcontainers.ConnectedEnvironmentsDaprComponentsClient type. type ConnectedEnvironmentsDaprComponentsServer struct { - // CreateOrUpdate is the fake for method ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope armappcontainers.DaprComponent, options *armappcontainers.ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method ConnectedEnvironmentsDaprComponentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, daprComponentEnvelope armappcontainers.ConnectedEnvironmentDaprComponent, options *armappcontainers.ConnectedEnvironmentsDaprComponentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - // Delete is the fake for method ConnectedEnvironmentsDaprComponentsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *armappcontainers.ConnectedEnvironmentsDaprComponentsClientDeleteOptions) (resp azfake.Responder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method ConnectedEnvironmentsDaprComponentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, componentName string, options *armappcontainers.ConnectedEnvironmentsDaprComponentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ConnectedEnvironmentsDaprComponentsClient.Get // HTTP status codes to indicate success: http.StatusOK @@ -51,16 +50,20 @@ type ConnectedEnvironmentsDaprComponentsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewConnectedEnvironmentsDaprComponentsServerTransport(srv *ConnectedEnvironmentsDaprComponentsServer) *ConnectedEnvironmentsDaprComponentsServerTransport { return &ConnectedEnvironmentsDaprComponentsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientListResponse]](), + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientListResponse]](), } } // ConnectedEnvironmentsDaprComponentsServerTransport connects instances of armappcontainers.ConnectedEnvironmentsDaprComponentsClient to instances of ConnectedEnvironmentsDaprComponentsServer. // Don't use this type directly, use NewConnectedEnvironmentsDaprComponentsServerTransport instead. type ConnectedEnvironmentsDaprComponentsServerTransport struct { - srv *ConnectedEnvironmentsDaprComponentsServer - newListPager *tracker[azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientListResponse]] + srv *ConnectedEnvironmentsDaprComponentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armappcontainers.ConnectedEnvironmentsDaprComponentsClientListResponse]] } // Do implements the policy.Transporter interface for ConnectedEnvironmentsDaprComponentsServerTransport. @@ -75,10 +78,10 @@ func (c *ConnectedEnvironmentsDaprComponentsServerTransport) Do(req *http.Reques var err error switch method { - case "ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate": - resp, err = c.dispatchCreateOrUpdate(req) - case "ConnectedEnvironmentsDaprComponentsClient.Delete": - resp, err = c.dispatchDelete(req) + case "ConnectedEnvironmentsDaprComponentsClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "ConnectedEnvironmentsDaprComponentsClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) case "ConnectedEnvironmentsDaprComponentsClient.Get": resp, err = c.dispatchGet(req) case "ConnectedEnvironmentsDaprComponentsClient.NewListPager": @@ -96,81 +99,103 @@ func (c *ConnectedEnvironmentsDaprComponentsServerTransport) Do(req *http.Reques return resp, nil } -func (c *ConnectedEnvironmentsDaprComponentsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if c.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armappcontainers.DaprComponent](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err +func (c *ConnectedEnvironmentsDaprComponentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} } - connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) - if err != nil { - return nil, err + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.ConnectedEnvironmentDaprComponent](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) + if err != nil { + return nil, err + } + componentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("componentName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, componentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) } - componentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("componentName")]) + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) if err != nil { return nil, err } - respr, errRespr := c.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, componentNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DaprComponent, req) - if err != nil { - return nil, err + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) } + return resp, nil } -func (c *ConnectedEnvironmentsDaprComponentsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if c.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err +func (c *ConnectedEnvironmentsDaprComponentsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } - connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) - if err != nil { - return nil, err + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) + if err != nil { + return nil, err + } + componentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("componentName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, componentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) } - componentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("componentName")]) + + resp, err := server.PollerResponderNext(beginDelete, req) if err != nil { return nil, err } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, componentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) } + return resp, nil } @@ -204,7 +229,7 @@ func (c *ConnectedEnvironmentsDaprComponentsServerTransport) dispatchGet(req *ht if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DaprComponent, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectedEnvironmentDaprComponent, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsstorages_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsstorages_server.go index 87a61a5c2952..f9ef2003485c 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsstorages_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsstorages_server.go @@ -12,25 +12,24 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ConnectedEnvironmentsStoragesServer is a fake server for instances of the armappcontainers.ConnectedEnvironmentsStoragesClient type. type ConnectedEnvironmentsStoragesServer struct { - // CreateOrUpdate is the fake for method ConnectedEnvironmentsStoragesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope armappcontainers.ConnectedEnvironmentStorage, options *armappcontainers.ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method ConnectedEnvironmentsStoragesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, storageEnvelope armappcontainers.ConnectedEnvironmentStorage, options *armappcontainers.ConnectedEnvironmentsStoragesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - // Delete is the fake for method ConnectedEnvironmentsStoragesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *armappcontainers.ConnectedEnvironmentsStoragesClientDeleteOptions) (resp azfake.Responder[armappcontainers.ConnectedEnvironmentsStoragesClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method ConnectedEnvironmentsStoragesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, storageName string, options *armappcontainers.ConnectedEnvironmentsStoragesClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsStoragesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ConnectedEnvironmentsStoragesClient.Get // HTTP status codes to indicate success: http.StatusOK @@ -45,13 +44,19 @@ type ConnectedEnvironmentsStoragesServer struct { // The returned ConnectedEnvironmentsStoragesServerTransport instance is connected to an instance of armappcontainers.ConnectedEnvironmentsStoragesClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewConnectedEnvironmentsStoragesServerTransport(srv *ConnectedEnvironmentsStoragesServer) *ConnectedEnvironmentsStoragesServerTransport { - return &ConnectedEnvironmentsStoragesServerTransport{srv: srv} + return &ConnectedEnvironmentsStoragesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsStoragesClientDeleteResponse]](), + } } // ConnectedEnvironmentsStoragesServerTransport connects instances of armappcontainers.ConnectedEnvironmentsStoragesClient to instances of ConnectedEnvironmentsStoragesServer. // Don't use this type directly, use NewConnectedEnvironmentsStoragesServerTransport instead. type ConnectedEnvironmentsStoragesServerTransport struct { - srv *ConnectedEnvironmentsStoragesServer + srv *ConnectedEnvironmentsStoragesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.ConnectedEnvironmentsStoragesClientDeleteResponse]] } // Do implements the policy.Transporter interface for ConnectedEnvironmentsStoragesServerTransport. @@ -66,10 +71,10 @@ func (c *ConnectedEnvironmentsStoragesServerTransport) Do(req *http.Request) (*h var err error switch method { - case "ConnectedEnvironmentsStoragesClient.CreateOrUpdate": - resp, err = c.dispatchCreateOrUpdate(req) - case "ConnectedEnvironmentsStoragesClient.Delete": - resp, err = c.dispatchDelete(req) + case "ConnectedEnvironmentsStoragesClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "ConnectedEnvironmentsStoragesClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) case "ConnectedEnvironmentsStoragesClient.Get": resp, err = c.dispatchGet(req) case "ConnectedEnvironmentsStoragesClient.List": @@ -85,81 +90,103 @@ func (c *ConnectedEnvironmentsStoragesServerTransport) Do(req *http.Request) (*h return resp, nil } -func (c *ConnectedEnvironmentsStoragesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if c.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/storages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armappcontainers.ConnectedEnvironmentStorage](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) - if err != nil { - return nil, err +func (c *ConnectedEnvironmentsStoragesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/storages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.ConnectedEnvironmentStorage](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) + if err != nil { + return nil, err + } + storageNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("storageName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, storageNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) } - storageNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("storageName")]) + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) if err != nil { return nil, err } - respr, errRespr := c.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, storageNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectedEnvironmentStorage, req) - if err != nil { - return nil, err + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) } + return resp, nil } -func (c *ConnectedEnvironmentsStoragesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if c.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/storages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) +func (c *ConnectedEnvironmentsStoragesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/connectedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/storages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) + if err != nil { + return nil, err + } + storageNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("storageName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, storageNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - connectedEnvironmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedEnvironmentName")]) - if err != nil { - return nil, err - } - storageNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("storageName")]) + + resp, err := server.PollerResponderNext(beginDelete, req) if err != nil { return nil, err } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, connectedEnvironmentNameParam, storageNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) } + return resp, nil } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerapps_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerapps_server.go index 66764ff84795..dce2e07f26c2 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerapps_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerapps_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsServer is a fake server for instances of the armappcontainers.ContainerAppsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsapi_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsapi_server.go index 84cf870fcb4f..43d56f17d794 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsapi_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsapi_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsAPIServer is a fake server for instances of the armappcontainers.ContainerAppsAPIClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsauthconfigs_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsauthconfigs_server.go index 31ff382f8d88..5eb1a3c7da0a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsauthconfigs_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsauthconfigs_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsAuthConfigsServer is a fake server for instances of the armappcontainers.ContainerAppsAuthConfigsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuilds_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuilds_server.go index 38f0954295ee..cc236bb44602 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuilds_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuilds_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsBuildsServer is a fake server for instances of the armappcontainers.ContainerAppsBuildsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuildsbycontainerapp_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuildsbycontainerapp_server.go index 31796dd6be77..5e780c7167a8 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuildsbycontainerapp_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuildsbycontainerapp_server.go @@ -11,15 +11,14 @@ package fake import ( "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsBuildsByContainerAppServer is a fake server for instances of the armappcontainers.ContainerAppsBuildsByContainerAppClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsdiagnostics_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsdiagnostics_server.go index 1efe63b4eead..ed86f9954b42 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsdiagnostics_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsdiagnostics_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsDiagnosticsServer is a fake server for instances of the armappcontainers.ContainerAppsDiagnosticsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappslabelhistory_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappslabelhistory_server.go new file mode 100644 index 000000000000..e743a66eeeb1 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappslabelhistory_server.go @@ -0,0 +1,168 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" +) + +// ContainerAppsLabelHistoryServer is a fake server for instances of the armappcontainers.ContainerAppsLabelHistoryClient type. +type ContainerAppsLabelHistoryServer struct { + // GetLabelHistory is the fake for method ContainerAppsLabelHistoryClient.GetLabelHistory + // HTTP status codes to indicate success: http.StatusOK + GetLabelHistory func(ctx context.Context, resourceGroupName string, containerAppName string, labelName string, options *armappcontainers.ContainerAppsLabelHistoryClientGetLabelHistoryOptions) (resp azfake.Responder[armappcontainers.ContainerAppsLabelHistoryClientGetLabelHistoryResponse], errResp azfake.ErrorResponder) + + // NewListLabelHistoryPager is the fake for method ContainerAppsLabelHistoryClient.NewListLabelHistoryPager + // HTTP status codes to indicate success: http.StatusOK + NewListLabelHistoryPager func(resourceGroupName string, containerAppName string, options *armappcontainers.ContainerAppsLabelHistoryClientListLabelHistoryOptions) (resp azfake.PagerResponder[armappcontainers.ContainerAppsLabelHistoryClientListLabelHistoryResponse]) +} + +// NewContainerAppsLabelHistoryServerTransport creates a new instance of ContainerAppsLabelHistoryServerTransport with the provided implementation. +// The returned ContainerAppsLabelHistoryServerTransport instance is connected to an instance of armappcontainers.ContainerAppsLabelHistoryClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContainerAppsLabelHistoryServerTransport(srv *ContainerAppsLabelHistoryServer) *ContainerAppsLabelHistoryServerTransport { + return &ContainerAppsLabelHistoryServerTransport{ + srv: srv, + newListLabelHistoryPager: newTracker[azfake.PagerResponder[armappcontainers.ContainerAppsLabelHistoryClientListLabelHistoryResponse]](), + } +} + +// ContainerAppsLabelHistoryServerTransport connects instances of armappcontainers.ContainerAppsLabelHistoryClient to instances of ContainerAppsLabelHistoryServer. +// Don't use this type directly, use NewContainerAppsLabelHistoryServerTransport instead. +type ContainerAppsLabelHistoryServerTransport struct { + srv *ContainerAppsLabelHistoryServer + newListLabelHistoryPager *tracker[azfake.PagerResponder[armappcontainers.ContainerAppsLabelHistoryClientListLabelHistoryResponse]] +} + +// Do implements the policy.Transporter interface for ContainerAppsLabelHistoryServerTransport. +func (c *ContainerAppsLabelHistoryServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ContainerAppsLabelHistoryClient.GetLabelHistory": + resp, err = c.dispatchGetLabelHistory(req) + case "ContainerAppsLabelHistoryClient.NewListLabelHistoryPager": + resp, err = c.dispatchNewListLabelHistoryPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContainerAppsLabelHistoryServerTransport) dispatchGetLabelHistory(req *http.Request) (*http.Response, error) { + if c.srv.GetLabelHistory == nil { + return nil, &nonRetriableError{errors.New("fake for method GetLabelHistory not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/labelHistory/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + containerAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerAppName")]) + if err != nil { + return nil, err + } + labelNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("labelName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.GetLabelHistory(req.Context(), resourceGroupNameParam, containerAppNameParam, labelNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LabelHistory, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ContainerAppsLabelHistoryServerTransport) dispatchNewListLabelHistoryPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListLabelHistoryPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListLabelHistoryPager not implemented")} + } + newListLabelHistoryPager := c.newListLabelHistoryPager.get(req) + if newListLabelHistoryPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/labelHistory` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + containerAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerAppName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + var options *armappcontainers.ContainerAppsLabelHistoryClientListLabelHistoryOptions + if filterParam != nil { + options = &armappcontainers.ContainerAppsLabelHistoryClientListLabelHistoryOptions{ + Filter: filterParam, + } + } + resp := c.srv.NewListLabelHistoryPager(resourceGroupNameParam, containerAppNameParam, options) + newListLabelHistoryPager = &resp + c.newListLabelHistoryPager.add(req, newListLabelHistoryPager) + server.PagerResponderInjectNextLinks(newListLabelHistoryPager, req, func(page *armappcontainers.ContainerAppsLabelHistoryClientListLabelHistoryResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListLabelHistoryPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListLabelHistoryPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListLabelHistoryPager) { + c.newListLabelHistoryPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappspatches_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappspatches_server.go index 18be3208ac09..6084f4382699 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappspatches_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappspatches_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsPatchesServer is a fake server for instances of the armappcontainers.ContainerAppsPatchesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisionreplicas_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisionreplicas_server.go index f088fef363f2..e717e5f1feb2 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisionreplicas_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisionreplicas_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsRevisionReplicasServer is a fake server for instances of the armappcontainers.ContainerAppsRevisionReplicasClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisions_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisions_server.go index 25666dad3ace..c067b284ec98 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisions_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisions_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsRevisionsServer is a fake server for instances of the armappcontainers.ContainerAppsRevisionsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssessionpools_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssessionpools_server.go index c69f07f68dae..437ee8280f0b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssessionpools_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssessionpools_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ContainerAppsSessionPoolsServer is a fake server for instances of the armappcontainers.ContainerAppsSessionPoolsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssourcecontrols_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssourcecontrols_server.go index 4befa944532d..0e63a21e612a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssourcecontrols_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssourcecontrols_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" + "strconv" ) // ContainerAppsSourceControlsServer is a fake server for instances of the armappcontainers.ContainerAppsSourceControlsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponentresiliencypolicies_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponentresiliencypolicies_server.go index abadab5a86c5..1fb7c3f1618b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponentresiliencypolicies_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponentresiliencypolicies_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // DaprComponentResiliencyPoliciesServer is a fake server for instances of the armappcontainers.DaprComponentResiliencyPoliciesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponents_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponents_server.go index 7770e429b7bb..1ac347b26dcd 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponents_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponents_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // DaprComponentsServer is a fake server for instances of the armappcontainers.DaprComponentsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprsubscriptions_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprsubscriptions_server.go index 81f4ffa6389d..3c336d4a5e73 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprsubscriptions_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprsubscriptions_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // DaprSubscriptionsServer is a fake server for instances of the armappcontainers.DaprSubscriptionsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/dotnetcomponents_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/dotnetcomponents_server.go index eb3a6cb617c2..5d8a5047daf4 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/dotnetcomponents_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/dotnetcomponents_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // DotNetComponentsServer is a fake server for instances of the armappcontainers.DotNetComponentsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/functionsextension_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/functionsextension_server.go index 2074b89e16eb..dd50bd60af85 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/functionsextension_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/functionsextension_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // FunctionsExtensionServer is a fake server for instances of the armappcontainers.FunctionsExtensionClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/httprouteconfig_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/httprouteconfig_server.go new file mode 100644 index 000000000000..12b84f5866b1 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/httprouteconfig_server.go @@ -0,0 +1,300 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// HTTPRouteConfigServer is a fake server for instances of the armappcontainers.HTTPRouteConfigClient type. +type HTTPRouteConfigServer struct { + // CreateOrUpdate is the fake for method HTTPRouteConfigClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *armappcontainers.HTTPRouteConfigClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.HTTPRouteConfigClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method HTTPRouteConfigClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *armappcontainers.HTTPRouteConfigClientDeleteOptions) (resp azfake.Responder[armappcontainers.HTTPRouteConfigClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method HTTPRouteConfigClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *armappcontainers.HTTPRouteConfigClientGetOptions) (resp azfake.Responder[armappcontainers.HTTPRouteConfigClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method HTTPRouteConfigClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, environmentName string, options *armappcontainers.HTTPRouteConfigClientListOptions) (resp azfake.PagerResponder[armappcontainers.HTTPRouteConfigClientListResponse]) + + // Update is the fake for method HTTPRouteConfigClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, httpRouteConfigEnvelope armappcontainers.HTTPRouteConfig, options *armappcontainers.HTTPRouteConfigClientUpdateOptions) (resp azfake.Responder[armappcontainers.HTTPRouteConfigClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewHTTPRouteConfigServerTransport creates a new instance of HTTPRouteConfigServerTransport with the provided implementation. +// The returned HTTPRouteConfigServerTransport instance is connected to an instance of armappcontainers.HTTPRouteConfigClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHTTPRouteConfigServerTransport(srv *HTTPRouteConfigServer) *HTTPRouteConfigServerTransport { + return &HTTPRouteConfigServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armappcontainers.HTTPRouteConfigClientListResponse]](), + } +} + +// HTTPRouteConfigServerTransport connects instances of armappcontainers.HTTPRouteConfigClient to instances of HTTPRouteConfigServer. +// Don't use this type directly, use NewHTTPRouteConfigServerTransport instead. +type HTTPRouteConfigServerTransport struct { + srv *HTTPRouteConfigServer + newListPager *tracker[azfake.PagerResponder[armappcontainers.HTTPRouteConfigClientListResponse]] +} + +// Do implements the policy.Transporter interface for HTTPRouteConfigServerTransport. +func (h *HTTPRouteConfigServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HTTPRouteConfigClient.CreateOrUpdate": + resp, err = h.dispatchCreateOrUpdate(req) + case "HTTPRouteConfigClient.Delete": + resp, err = h.dispatchDelete(req) + case "HTTPRouteConfigClient.Get": + resp, err = h.dispatchGet(req) + case "HTTPRouteConfigClient.NewListPager": + resp, err = h.dispatchNewListPager(req) + case "HTTPRouteConfigClient.Update": + resp, err = h.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HTTPRouteConfigServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if h.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/httpRouteConfigs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.HTTPRouteConfig](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + httpRouteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("httpRouteName")]) + if err != nil { + return nil, err + } + var options *armappcontainers.HTTPRouteConfigClientCreateOrUpdateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armappcontainers.HTTPRouteConfigClientCreateOrUpdateOptions{ + HTTPRouteConfigEnvelope: &body, + } + } + respr, errRespr := h.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, httpRouteNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HTTPRouteConfig, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HTTPRouteConfigServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if h.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/httpRouteConfigs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + httpRouteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("httpRouteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Delete(req.Context(), resourceGroupNameParam, environmentNameParam, httpRouteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HTTPRouteConfigServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/httpRouteConfigs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + httpRouteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("httpRouteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, environmentNameParam, httpRouteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HTTPRouteConfig, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HTTPRouteConfigServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if h.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := h.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/httpRouteConfigs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListPager(resourceGroupNameParam, environmentNameParam, nil) + newListPager = &resp + h.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.HTTPRouteConfigClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + h.newListPager.remove(req) + } + return resp, nil +} + +func (h *HTTPRouteConfigServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if h.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/httpRouteConfigs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.HTTPRouteConfig](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + httpRouteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("httpRouteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Update(req.Context(), resourceGroupNameParam, environmentNameParam, httpRouteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HTTPRouteConfig, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/internal.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/internal.go index c423f69a92d1..c63abf57927c 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/internal.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/internal.go @@ -9,11 +9,10 @@ package fake import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" "reflect" "sync" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" ) type nonRetriableError struct { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/javacomponents_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/javacomponents_server.go index fe84627587a3..69c641287b38 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/javacomponents_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/javacomponents_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // JavaComponentsServer is a fake server for instances of the armappcontainers.JavaComponentsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobs_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobs_server.go index 6813d1e1115c..4fc4a8522edb 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobs_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobs_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "reflect" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "reflect" + "regexp" ) // JobsServer is a fake server for instances of the armappcontainers.JobsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobsexecutions_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobsexecutions_server.go index 819baaab8e17..e93adae33317 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobsexecutions_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobsexecutions_server.go @@ -11,15 +11,14 @@ package fake import ( "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // JobsExecutionsServer is a fake server for instances of the armappcontainers.JobsExecutionsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/logicapps_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/logicapps_server.go index f026494f5a8e..3a10fdb58548 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/logicapps_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/logicapps_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "reflect" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "reflect" + "regexp" ) // LogicAppsServer is a fake server for instances of the armappcontainers.LogicAppsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/maintenanceconfigurations_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/maintenanceconfigurations_server.go new file mode 100644 index 000000000000..f4a4e1313e9a --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/maintenanceconfigurations_server.go @@ -0,0 +1,246 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" +) + +// MaintenanceConfigurationsServer is a fake server for instances of the armappcontainers.MaintenanceConfigurationsClient type. +type MaintenanceConfigurationsServer struct { + // CreateOrUpdate is the fake for method MaintenanceConfigurationsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, environmentName string, configName string, maintenanceConfigurationEnvelope armappcontainers.MaintenanceConfigurationResource, options *armappcontainers.MaintenanceConfigurationsClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.MaintenanceConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method MaintenanceConfigurationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, environmentName string, configName string, options *armappcontainers.MaintenanceConfigurationsClientDeleteOptions) (resp azfake.Responder[armappcontainers.MaintenanceConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MaintenanceConfigurationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, environmentName string, configName string, options *armappcontainers.MaintenanceConfigurationsClientGetOptions) (resp azfake.Responder[armappcontainers.MaintenanceConfigurationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method MaintenanceConfigurationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, environmentName string, options *armappcontainers.MaintenanceConfigurationsClientListOptions) (resp azfake.PagerResponder[armappcontainers.MaintenanceConfigurationsClientListResponse]) +} + +// NewMaintenanceConfigurationsServerTransport creates a new instance of MaintenanceConfigurationsServerTransport with the provided implementation. +// The returned MaintenanceConfigurationsServerTransport instance is connected to an instance of armappcontainers.MaintenanceConfigurationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMaintenanceConfigurationsServerTransport(srv *MaintenanceConfigurationsServer) *MaintenanceConfigurationsServerTransport { + return &MaintenanceConfigurationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armappcontainers.MaintenanceConfigurationsClientListResponse]](), + } +} + +// MaintenanceConfigurationsServerTransport connects instances of armappcontainers.MaintenanceConfigurationsClient to instances of MaintenanceConfigurationsServer. +// Don't use this type directly, use NewMaintenanceConfigurationsServerTransport instead. +type MaintenanceConfigurationsServerTransport struct { + srv *MaintenanceConfigurationsServer + newListPager *tracker[azfake.PagerResponder[armappcontainers.MaintenanceConfigurationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for MaintenanceConfigurationsServerTransport. +func (m *MaintenanceConfigurationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "MaintenanceConfigurationsClient.CreateOrUpdate": + resp, err = m.dispatchCreateOrUpdate(req) + case "MaintenanceConfigurationsClient.Delete": + resp, err = m.dispatchDelete(req) + case "MaintenanceConfigurationsClient.Get": + resp, err = m.dispatchGet(req) + case "MaintenanceConfigurationsClient.NewListPager": + resp, err = m.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MaintenanceConfigurationsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/maintenanceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.MaintenanceConfigurationResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + configNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, configNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MaintenanceConfigurationResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MaintenanceConfigurationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if m.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/maintenanceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + configNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameParam, environmentNameParam, configNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MaintenanceConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/maintenanceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + configNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, environmentNameParam, configNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MaintenanceConfigurationResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MaintenanceConfigurationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/maintenanceConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListPager(resourceGroupNameParam, environmentNameParam, nil) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.MaintenanceConfigurationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedcertificates_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedcertificates_server.go index 87c79b5e255f..75a8cf977fe5 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedcertificates_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedcertificates_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "reflect" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "reflect" + "regexp" ) // ManagedCertificatesServer is a fake server for instances of the armappcontainers.ManagedCertificatesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentdiagnostics_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentdiagnostics_server.go index 416184a99668..5ba01c3597cf 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentdiagnostics_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentdiagnostics_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ManagedEnvironmentDiagnosticsServer is a fake server for instances of the armappcontainers.ManagedEnvironmentDiagnosticsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivateendpointconnections_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivateendpointconnections_server.go index ba994e228567..8b914ba15081 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivateendpointconnections_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivateendpointconnections_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ManagedEnvironmentPrivateEndpointConnectionsServer is a fake server for instances of the armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivatelinkresources_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivatelinkresources_server.go index f215c55c0d12..b93d69827107 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivatelinkresources_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivatelinkresources_server.go @@ -11,15 +11,14 @@ package fake import ( "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ManagedEnvironmentPrivateLinkResourcesServer is a fake server for instances of the armappcontainers.ManagedEnvironmentPrivateLinkResourcesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironments_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironments_server.go index 9aa9d0e6e94b..086b1f1c52bb 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironments_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironments_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ManagedEnvironmentsServer is a fake server for instances of the armappcontainers.ManagedEnvironmentsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsdiagnostics_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsdiagnostics_server.go index 00843cabb2fc..d7b2a86507a1 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsdiagnostics_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsdiagnostics_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ManagedEnvironmentsDiagnosticsServer is a fake server for instances of the armappcontainers.ManagedEnvironmentsDiagnosticsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsstorages_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsstorages_server.go index c92629c5f94d..2324046f5f9b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsstorages_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsstorages_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ManagedEnvironmentsStoragesServer is a fake server for instances of the armappcontainers.ManagedEnvironmentsStoragesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentusages_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentusages_server.go index 68957de1289d..32087e3a5244 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentusages_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentusages_server.go @@ -11,15 +11,14 @@ package fake import ( "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // ManagedEnvironmentUsagesServer is a fake server for instances of the armappcontainers.ManagedEnvironmentUsagesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/namespaces_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/namespaces_server.go index 01944a7af0fa..5dbe1ef42f85 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/namespaces_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/namespaces_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // NamespacesServer is a fake server for instances of the armappcontainers.NamespacesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/operations_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/operations_server.go index 4d523d2865f0..167f397dca90 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/operations_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/operations_server.go @@ -11,13 +11,12 @@ package fake import ( "errors" "fmt" - "net/http" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" ) // OperationsServer is a fake server for instances of the armappcontainers.OperationsClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/server_factory.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/server_factory.go index 2dff12086ed7..a4371a59ee13 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/server_factory.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/server_factory.go @@ -11,11 +11,10 @@ package fake import ( "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "strings" "sync" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ServerFactory is a fake server for instances of the armappcontainers.ClientFactory type. @@ -38,6 +37,7 @@ type ServerFactory struct { ContainerAppsBuildsServer ContainerAppsBuildsServer ContainerAppsServer ContainerAppsServer ContainerAppsDiagnosticsServer ContainerAppsDiagnosticsServer + ContainerAppsLabelHistoryServer ContainerAppsLabelHistoryServer ContainerAppsPatchesServer ContainerAppsPatchesServer ContainerAppsRevisionReplicasServer ContainerAppsRevisionReplicasServer ContainerAppsRevisionsServer ContainerAppsRevisionsServer @@ -48,10 +48,12 @@ type ServerFactory struct { DaprSubscriptionsServer DaprSubscriptionsServer DotNetComponentsServer DotNetComponentsServer FunctionsExtensionServer FunctionsExtensionServer + HTTPRouteConfigServer HTTPRouteConfigServer JavaComponentsServer JavaComponentsServer JobsServer JobsServer JobsExecutionsServer JobsExecutionsServer LogicAppsServer LogicAppsServer + MaintenanceConfigurationsServer MaintenanceConfigurationsServer ManagedCertificatesServer ManagedCertificatesServer ManagedEnvironmentDiagnosticsServer ManagedEnvironmentDiagnosticsServer ManagedEnvironmentPrivateEndpointConnectionsServer ManagedEnvironmentPrivateEndpointConnectionsServer @@ -97,6 +99,7 @@ type ServerFactoryTransport struct { trContainerAppsBuildsServer *ContainerAppsBuildsServerTransport trContainerAppsServer *ContainerAppsServerTransport trContainerAppsDiagnosticsServer *ContainerAppsDiagnosticsServerTransport + trContainerAppsLabelHistoryServer *ContainerAppsLabelHistoryServerTransport trContainerAppsPatchesServer *ContainerAppsPatchesServerTransport trContainerAppsRevisionReplicasServer *ContainerAppsRevisionReplicasServerTransport trContainerAppsRevisionsServer *ContainerAppsRevisionsServerTransport @@ -107,10 +110,12 @@ type ServerFactoryTransport struct { trDaprSubscriptionsServer *DaprSubscriptionsServerTransport trDotNetComponentsServer *DotNetComponentsServerTransport trFunctionsExtensionServer *FunctionsExtensionServerTransport + trHTTPRouteConfigServer *HTTPRouteConfigServerTransport trJavaComponentsServer *JavaComponentsServerTransport trJobsServer *JobsServerTransport trJobsExecutionsServer *JobsExecutionsServerTransport trLogicAppsServer *LogicAppsServerTransport + trMaintenanceConfigurationsServer *MaintenanceConfigurationsServerTransport trManagedCertificatesServer *ManagedCertificatesServerTransport trManagedEnvironmentDiagnosticsServer *ManagedEnvironmentDiagnosticsServerTransport trManagedEnvironmentPrivateEndpointConnectionsServer *ManagedEnvironmentPrivateEndpointConnectionsServerTransport @@ -221,6 +226,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewContainerAppsDiagnosticsServerTransport(&s.srv.ContainerAppsDiagnosticsServer) }) resp, err = s.trContainerAppsDiagnosticsServer.Do(req) + case "ContainerAppsLabelHistoryClient": + initServer(s, &s.trContainerAppsLabelHistoryServer, func() *ContainerAppsLabelHistoryServerTransport { + return NewContainerAppsLabelHistoryServerTransport(&s.srv.ContainerAppsLabelHistoryServer) + }) + resp, err = s.trContainerAppsLabelHistoryServer.Do(req) case "ContainerAppsPatchesClient": initServer(s, &s.trContainerAppsPatchesServer, func() *ContainerAppsPatchesServerTransport { return NewContainerAppsPatchesServerTransport(&s.srv.ContainerAppsPatchesServer) @@ -271,6 +281,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewFunctionsExtensionServerTransport(&s.srv.FunctionsExtensionServer) }) resp, err = s.trFunctionsExtensionServer.Do(req) + case "HTTPRouteConfigClient": + initServer(s, &s.trHTTPRouteConfigServer, func() *HTTPRouteConfigServerTransport { + return NewHTTPRouteConfigServerTransport(&s.srv.HTTPRouteConfigServer) + }) + resp, err = s.trHTTPRouteConfigServer.Do(req) case "JavaComponentsClient": initServer(s, &s.trJavaComponentsServer, func() *JavaComponentsServerTransport { return NewJavaComponentsServerTransport(&s.srv.JavaComponentsServer) @@ -287,6 +302,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "LogicAppsClient": initServer(s, &s.trLogicAppsServer, func() *LogicAppsServerTransport { return NewLogicAppsServerTransport(&s.srv.LogicAppsServer) }) resp, err = s.trLogicAppsServer.Do(req) + case "MaintenanceConfigurationsClient": + initServer(s, &s.trMaintenanceConfigurationsServer, func() *MaintenanceConfigurationsServerTransport { + return NewMaintenanceConfigurationsServerTransport(&s.srv.MaintenanceConfigurationsServer) + }) + resp, err = s.trMaintenanceConfigurationsServer.Do(req) case "ManagedCertificatesClient": initServer(s, &s.trManagedCertificatesServer, func() *ManagedCertificatesServerTransport { return NewManagedCertificatesServerTransport(&s.srv.ManagedCertificatesServer) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/time_rfc3339.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/time_rfc3339.go index ade6004b9922..81f308b0d343 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/time_rfc3339.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/time_rfc3339.go @@ -11,12 +11,11 @@ package fake import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/usages_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/usages_server.go index f6da5c8fb458..e8fb6fb0f293 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/usages_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/usages_server.go @@ -11,15 +11,14 @@ package fake import ( "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v3" + "net/http" + "net/url" + "regexp" ) // UsagesServer is a fake server for instances of the armappcontainers.UsagesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client.go index 303593e5ad50..601103f105cb 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // FunctionsExtensionClient contains the methods for the FunctionsExtension group. @@ -47,7 +46,7 @@ func NewFunctionsExtensionClient(subscriptionID string, credential azcore.TokenC // InvokeFunctionsHost - Proxies a Functions host call to the function app backed by the container app. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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, the parent resource. @@ -104,7 +103,7 @@ func (client *FunctionsExtensionClient) invokeFunctionsHostCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client_example_test.go deleted file mode 100644 index 7ca0fce77034..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client_example_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/FunctionsExtension_Post.json -func ExampleFunctionsExtensionClient_InvokeFunctionsHost() { - 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.NewFunctionsExtensionClient().InvokeFunctionsHost(ctx, "rg", "testcontainerApp0", "testcontainerApp0-pjxhsye", "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.Value = "{\"status\":\"success\"}" -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/go.mod b/sdk/resourcemanager/appcontainers/armappcontainers/go.mod index 73352604166e..50c17611b47c 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/go.mod +++ b/sdk/resourcemanager/appcontainers/armappcontainers/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armap go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/go.sum b/sdk/resourcemanager/appcontainers/armappcontainers/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/go.sum +++ b/sdk/resourcemanager/appcontainers/armappcontainers/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/httprouteconfig_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/httprouteconfig_client.go new file mode 100644 index 000000000000..9e1b0550549f --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/httprouteconfig_client.go @@ -0,0 +1,386 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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" +) + +// HTTPRouteConfigClient contains the methods for the HTTPRouteConfig group. +// Don't use this type directly, use NewHTTPRouteConfigClient() instead. +type HTTPRouteConfigClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHTTPRouteConfigClient creates a new instance of HTTPRouteConfigClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHTTPRouteConfigClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HTTPRouteConfigClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HTTPRouteConfigClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or Update a Http Route Config. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - httpRouteName - Name of the Http Route Config Resource. +// - options - HTTPRouteConfigClientCreateOrUpdateOptions contains the optional parameters for the HTTPRouteConfigClient.CreateOrUpdate +// method. +func (client *HTTPRouteConfigClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *HTTPRouteConfigClientCreateOrUpdateOptions) (HTTPRouteConfigClientCreateOrUpdateResponse, error) { + var err error + const operationName = "HTTPRouteConfigClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, httpRouteName, options) + if err != nil { + return HTTPRouteConfigClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HTTPRouteConfigClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return HTTPRouteConfigClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *HTTPRouteConfigClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *HTTPRouteConfigClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}" + 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 httpRouteName == "" { + return nil, errors.New("parameter httpRouteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{httpRouteName}", url.PathEscape(httpRouteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.HTTPRouteConfigEnvelope != nil { + if err := runtime.MarshalAsJSON(req, *options.HTTPRouteConfigEnvelope); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *HTTPRouteConfigClient) createOrUpdateHandleResponse(resp *http.Response) (HTTPRouteConfigClientCreateOrUpdateResponse, error) { + result := HTTPRouteConfigClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HTTPRouteConfig); err != nil { + return HTTPRouteConfigClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the specified Managed Http Route. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - httpRouteName - Name of the Http Route Config Resource. +// - options - HTTPRouteConfigClientDeleteOptions contains the optional parameters for the HTTPRouteConfigClient.Delete method. +func (client *HTTPRouteConfigClient) Delete(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *HTTPRouteConfigClientDeleteOptions) (HTTPRouteConfigClientDeleteResponse, error) { + var err error + const operationName = "HTTPRouteConfigClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, httpRouteName, options) + if err != nil { + return HTTPRouteConfigClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HTTPRouteConfigClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return HTTPRouteConfigClientDeleteResponse{}, err + } + return HTTPRouteConfigClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *HTTPRouteConfigClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *HTTPRouteConfigClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}" + 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 httpRouteName == "" { + return nil, errors.New("parameter httpRouteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{httpRouteName}", url.PathEscape(httpRouteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified Managed Http Route Config. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - httpRouteName - Name of the Http Route Config Resource. +// - options - HTTPRouteConfigClientGetOptions contains the optional parameters for the HTTPRouteConfigClient.Get method. +func (client *HTTPRouteConfigClient) Get(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *HTTPRouteConfigClientGetOptions) (HTTPRouteConfigClientGetResponse, error) { + var err error + const operationName = "HTTPRouteConfigClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, environmentName, httpRouteName, options) + if err != nil { + return HTTPRouteConfigClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HTTPRouteConfigClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HTTPRouteConfigClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HTTPRouteConfigClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, options *HTTPRouteConfigClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}" + 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 httpRouteName == "" { + return nil, errors.New("parameter httpRouteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{httpRouteName}", url.PathEscape(httpRouteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HTTPRouteConfigClient) getHandleResponse(resp *http.Response) (HTTPRouteConfigClientGetResponse, error) { + result := HTTPRouteConfigClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HTTPRouteConfig); err != nil { + return HTTPRouteConfigClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Managed Http Routes in a given managed environment. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - options - HTTPRouteConfigClientListOptions contains the optional parameters for the HTTPRouteConfigClient.NewListPager +// method. +func (client *HTTPRouteConfigClient) NewListPager(resourceGroupName string, environmentName string, options *HTTPRouteConfigClientListOptions) *runtime.Pager[HTTPRouteConfigClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[HTTPRouteConfigClientListResponse]{ + More: func(page HTTPRouteConfigClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HTTPRouteConfigClientListResponse) (HTTPRouteConfigClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HTTPRouteConfigClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, environmentName, options) + }, nil) + if err != nil { + return HTTPRouteConfigClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *HTTPRouteConfigClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *HTTPRouteConfigClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs" + 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", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *HTTPRouteConfigClient) listHandleResponse(resp *http.Response) (HTTPRouteConfigClientListResponse, error) { + result := HTTPRouteConfigClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HTTPRouteConfigCollection); err != nil { + return HTTPRouteConfigClientListResponse{}, err + } + return result, nil +} + +// Update - Patches an http route config resource. Only patching of tags is supported +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - httpRouteName - Name of the Http Route Config Resource. +// - httpRouteConfigEnvelope - Properties of http route config that need to be updated +// - options - HTTPRouteConfigClientUpdateOptions contains the optional parameters for the HTTPRouteConfigClient.Update method. +func (client *HTTPRouteConfigClient) Update(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, httpRouteConfigEnvelope HTTPRouteConfig, options *HTTPRouteConfigClientUpdateOptions) (HTTPRouteConfigClientUpdateResponse, error) { + var err error + const operationName = "HTTPRouteConfigClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, environmentName, httpRouteName, httpRouteConfigEnvelope, options) + if err != nil { + return HTTPRouteConfigClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HTTPRouteConfigClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HTTPRouteConfigClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *HTTPRouteConfigClient) updateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, httpRouteName string, httpRouteConfigEnvelope HTTPRouteConfig, options *HTTPRouteConfigClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}" + 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 httpRouteName == "" { + return nil, errors.New("parameter httpRouteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{httpRouteName}", url.PathEscape(httpRouteName)) + 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", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, httpRouteConfigEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *HTTPRouteConfigClient) updateHandleResponse(resp *http.Response) (HTTPRouteConfigClientUpdateResponse, error) { + result := HTTPRouteConfigClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HTTPRouteConfig); err != nil { + return HTTPRouteConfigClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client.go index 7cfd4fa86fc8..767747e3c54a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // JavaComponentsClient contains the methods for the JavaComponents group. @@ -47,7 +46,7 @@ func NewJavaComponentsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateOrUpdate - Creates or updates a Java Component in a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the Java Component. @@ -75,7 +74,7 @@ func (client *JavaComponentsClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Creates or updates a Java Component in a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JavaComponentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, name string, javaComponentEnvelope JavaComponent, options *JavaComponentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "JavaComponentsClient.BeginCreateOrUpdate" @@ -121,7 +120,7 @@ func (client *JavaComponentsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, javaComponentEnvelope); err != nil { @@ -133,7 +132,7 @@ func (client *JavaComponentsClient) createOrUpdateCreateRequest(ctx context.Cont // BeginDelete - Delete a Java Component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the Java Component. @@ -160,7 +159,7 @@ func (client *JavaComponentsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete a Java Component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JavaComponentsClient) deleteOperation(ctx context.Context, resourceGroupName string, environmentName string, name string, options *JavaComponentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "JavaComponentsClient.BeginDelete" @@ -206,7 +205,7 @@ func (client *JavaComponentsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +214,7 @@ func (client *JavaComponentsClient) deleteCreateRequest(ctx context.Context, res // Get - Get a Java Component. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the Java Component. @@ -266,7 +265,7 @@ func (client *JavaComponentsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +282,7 @@ func (client *JavaComponentsClient) getHandleResponse(resp *http.Response) (Java // NewListPager - Get the Java Components for a managed environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - options - JavaComponentsClientListOptions contains the optional parameters for the JavaComponentsClient.NewListPager method. @@ -330,7 +329,7 @@ func (client *JavaComponentsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -348,7 +347,7 @@ func (client *JavaComponentsClient) listHandleResponse(resp *http.Response) (Jav // BeginUpdate - Patches a Java Component using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - name - Name of the Java Component. @@ -375,7 +374,7 @@ func (client *JavaComponentsClient) BeginUpdate(ctx context.Context, resourceGro // Update - Patches a Java Component using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JavaComponentsClient) update(ctx context.Context, resourceGroupName string, environmentName string, name string, javaComponentEnvelope JavaComponent, options *JavaComponentsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "JavaComponentsClient.BeginUpdate" @@ -421,7 +420,7 @@ func (client *JavaComponentsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, javaComponentEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client_example_test.go deleted file mode 100644 index c26fe37fc022..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client_example_test.go +++ /dev/null @@ -1,593 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_List.json -func ExampleJavaComponentsClient_NewListPager_listJavaComponents() { - 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.NewJavaComponentsClient().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.JavaComponentsCollection = armappcontainers.JavaComponentsCollection{ - // Value: []*armappcontainers.JavaComponent{ - // { - // Name: to.Ptr("blueshark"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/blueshark"), - // Properties: &armappcontainers.SpringBootAdminComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - // Value: to.Ptr("true"), - // }, - // { - // PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // Ingress: &armappcontainers.JavaComponentIngress{ - // Fqdn: to.Ptr("myjavacomponent.myenvironment.test.net"), - // }, - // }, - // }, - // { - // Name: to.Ptr("yellowcat"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat"), - // Properties: &armappcontainers.SpringCloudEurekaComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringCloudEureka), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.cloud.config.server.git.uri"), - // Value: to.Ptr(""), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // Ingress: &armappcontainers.JavaComponentIngress{ - // Fqdn: to.Ptr("myjavacomponent.myenvironment.test.net"), - // }, - // }, - // }, - // { - // Name: to.Ptr("reddog"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/reddog"), - // Properties: &armappcontainers.SpringCloudGatewayComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringCloudGateway), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.cloud.gateway.enabled"), - // Value: to.Ptr("true"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // Ingress: &armappcontainers.JavaComponentIngress{ - // Fqdn: to.Ptr("myjavacomponent.myenvironment.test.net"), - // }, - // SpringCloudGatewayRoutes: []*armappcontainers.ScgRoute{ - // { - // Filters: []*string{ - // to.Ptr("SetPath=/{path}")}, - // ID: to.Ptr("route1"), - // Predicates: []*string{ - // to.Ptr("Path=/v1/{path}"), - // to.Ptr("After=2024-01-20T17:42:47.789-07:00[America/Denver]")}, - // URI: to.Ptr("https://otherjavacomponent.myenvironment.test.net"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_List_ServiceBind.json -func ExampleJavaComponentsClient_NewListPager_listJavaComponentsWithServiceBinds() { - 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.NewJavaComponentsClient().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.JavaComponentsCollection = armappcontainers.JavaComponentsCollection{ - // Value: []*armappcontainers.JavaComponent{ - // { - // Name: to.Ptr("blueshark"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/blueshark"), - // Properties: &armappcontainers.SpringBootAdminComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - // Value: to.Ptr("true"), - // }, - // { - // PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // ServiceBinds: []*armappcontainers.JavaComponentServiceBind{ - // { - // Name: to.Ptr("yellowcat"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("yellowcat"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat"), - // Properties: &armappcontainers.SpringCloudEurekaComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringCloudEureka), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.cloud.config.server.git.uri"), - // Value: to.Ptr(""), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // ServiceBinds: []*armappcontainers.JavaComponentServiceBind{ - // { - // Name: to.Ptr("blueshark"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/blueshark"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Get.json -func ExampleJavaComponentsClient_Get_getJavaComponent() { - 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.NewJavaComponentsClient().Get(ctx, "examplerg", "myenvironment", "myjavacomponent", 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.JavaComponent = armappcontainers.JavaComponent{ - // Name: to.Ptr("myjavacomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/myjavacomponent"), - // Properties: &armappcontainers.SpringBootAdminComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - // Value: to.Ptr("true"), - // }, - // { - // PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // Ingress: &armappcontainers.JavaComponentIngress{ - // Fqdn: to.Ptr("myjavacomponent.myenvironment.test.net"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Get_ServiceBind.json -func ExampleJavaComponentsClient_Get_getJavaComponentWithServiceBinds() { - 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.NewJavaComponentsClient().Get(ctx, "examplerg", "myenvironment", "myjavacomponent", 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.JavaComponent = armappcontainers.JavaComponent{ - // Name: to.Ptr("myjavacomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/myjavacomponent"), - // Properties: &armappcontainers.SpringBootAdminComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - // Value: to.Ptr("true"), - // }, - // { - // PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // ServiceBinds: []*armappcontainers.JavaComponentServiceBind{ - // { - // Name: to.Ptr("yellowcat"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_CreateOrUpdate.json -func ExampleJavaComponentsClient_BeginCreateOrUpdate_createOrUpdateJavaComponent() { - 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.NewJavaComponentsClient().BeginCreateOrUpdate(ctx, "examplerg", "myenvironment", "myjavacomponent", armappcontainers.JavaComponent{ - Properties: &armappcontainers.SpringBootAdminComponent{ - ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - { - PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - Value: to.Ptr("true"), - }, - { - PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - Value: to.Ptr("10000ms"), - }}, - Scale: &armappcontainers.JavaComponentPropertiesScale{ - MaxReplicas: to.Ptr[int32](1), - MinReplicas: to.Ptr[int32](1), - }, - }, - }, 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.JavaComponent = armappcontainers.JavaComponent{ - // Name: to.Ptr("myjavacomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/myjavacomponent"), - // Properties: &armappcontainers.SpringBootAdminComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - // Value: to.Ptr("true"), - // }, - // { - // PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // Ingress: &armappcontainers.JavaComponentIngress{ - // Fqdn: to.Ptr("myjavacomponent.myenvironment.test.net"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_CreateOrUpdate_ServiceBind.json -func ExampleJavaComponentsClient_BeginCreateOrUpdate_createOrUpdateJavaComponentWithServiceBinds() { - 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.NewJavaComponentsClient().BeginCreateOrUpdate(ctx, "examplerg", "myenvironment", "myjavacomponent", armappcontainers.JavaComponent{ - Properties: &armappcontainers.SpringBootAdminComponent{ - ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - { - PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - Value: to.Ptr("true"), - }, - { - PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - Value: to.Ptr("10000ms"), - }}, - Scale: &armappcontainers.JavaComponentPropertiesScale{ - MaxReplicas: to.Ptr[int32](1), - MinReplicas: to.Ptr[int32](1), - }, - ServiceBinds: []*armappcontainers.JavaComponentServiceBind{ - { - Name: to.Ptr("yellowcat"), - ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat"), - }}, - }, - }, 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.JavaComponent = armappcontainers.JavaComponent{ - // Name: to.Ptr("myjavacomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/myjavacomponent"), - // Properties: &armappcontainers.SpringBootAdminComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - // Value: to.Ptr("true"), - // }, - // { - // PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // ServiceBinds: []*armappcontainers.JavaComponentServiceBind{ - // { - // Name: to.Ptr("yellowcat"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Patch.json -func ExampleJavaComponentsClient_BeginUpdate_patchJavaComponent() { - 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.NewJavaComponentsClient().BeginUpdate(ctx, "examplerg", "myenvironment", "myjavacomponent", armappcontainers.JavaComponent{ - Properties: &armappcontainers.SpringBootAdminComponent{ - ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - { - PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - Value: to.Ptr("true"), - }, - { - PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - Value: to.Ptr("10000ms"), - }}, - Scale: &armappcontainers.JavaComponentPropertiesScale{ - MaxReplicas: to.Ptr[int32](1), - MinReplicas: to.Ptr[int32](1), - }, - }, - }, 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.JavaComponent = armappcontainers.JavaComponent{ - // Name: to.Ptr("myjavacomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/myjavacomponent"), - // Properties: &armappcontainers.SpringBootAdminComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - // Value: to.Ptr("true"), - // }, - // { - // PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // Ingress: &armappcontainers.JavaComponentIngress{ - // Fqdn: to.Ptr("myjavacomponent.myenvironment.test.net"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Patch_ServiceBind.json -func ExampleJavaComponentsClient_BeginUpdate_patchJavaComponentWithServiceBinds() { - 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.NewJavaComponentsClient().BeginUpdate(ctx, "examplerg", "myenvironment", "myjavacomponent", armappcontainers.JavaComponent{ - Properties: &armappcontainers.SpringBootAdminComponent{ - ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - { - PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - Value: to.Ptr("true"), - }, - { - PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - Value: to.Ptr("10000ms"), - }}, - Scale: &armappcontainers.JavaComponentPropertiesScale{ - MaxReplicas: to.Ptr[int32](1), - MinReplicas: to.Ptr[int32](1), - }, - ServiceBinds: []*armappcontainers.JavaComponentServiceBind{ - { - Name: to.Ptr("yellowcat"), - ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat"), - }}, - }, - }, 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.JavaComponent = armappcontainers.JavaComponent{ - // Name: to.Ptr("myjavacomponent"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/javaComponents"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/myjavacomponent"), - // Properties: &armappcontainers.SpringBootAdminComponent{ - // ComponentType: to.Ptr(armappcontainers.JavaComponentTypeSpringBootAdmin), - // Configurations: []*armappcontainers.JavaComponentConfigurationProperty{ - // { - // PropertyName: to.Ptr("spring.boot.admin.ui.enable-toasts"), - // Value: to.Ptr("true"), - // }, - // { - // PropertyName: to.Ptr("spring.boot.admin.monitor.status-interval"), - // Value: to.Ptr("10000ms"), - // }}, - // ProvisioningState: to.Ptr(armappcontainers.JavaComponentProvisioningStateSucceeded), - // Scale: &armappcontainers.JavaComponentPropertiesScale{ - // MaxReplicas: to.Ptr[int32](1), - // MinReplicas: to.Ptr[int32](1), - // }, - // ServiceBinds: []*armappcontainers.JavaComponentServiceBind{ - // { - // Name: to.Ptr("yellowcat"), - // ServiceID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Delete.json -func ExampleJavaComponentsClient_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.NewJavaComponentsClient().BeginDelete(ctx, "examplerg", "myenvironment", "myjavacomponent", 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) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go index 2e10df8f5ac4..a788e8c68022 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -47,7 +46,7 @@ func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, opt // BeginCreateOrUpdate - Create or Update a Container Apps Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - jobEnvelope - Properties used to create a container apps job @@ -74,7 +73,7 @@ func (client *JobsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroup // CreateOrUpdate - Create or Update a Container Apps Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JobsClient) createOrUpdate(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope Job, options *JobsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "JobsClient.BeginCreateOrUpdate" @@ -116,7 +115,7 @@ func (client *JobsClient) createOrUpdateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, jobEnvelope); err != nil { @@ -128,7 +127,7 @@ func (client *JobsClient) createOrUpdateCreateRequest(ctx context.Context, resou // BeginDelete - Delete a Container Apps Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - options - JobsClientBeginDeleteOptions contains the optional parameters for the JobsClient.BeginDelete method. @@ -153,7 +152,7 @@ func (client *JobsClient) BeginDelete(ctx context.Context, resourceGroupName str // Delete - Delete a Container Apps Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JobsClient) deleteOperation(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "JobsClient.BeginDelete" @@ -195,7 +194,7 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +203,7 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, resourceGroup // Get - Get the properties of a Container Apps Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. @@ -250,7 +249,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +267,7 @@ func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetR // GetDetector - Get the diagnostics data for a Container App Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - detectorName - Name of the Container App Job detector. @@ -319,7 +318,7 @@ func (client *JobsClient) getDetectorCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +335,7 @@ func (client *JobsClient) getDetectorHandleResponse(resp *http.Response) (JobsCl // NewListByResourceGroupPager - Get the Container Apps Jobs in a given resource group. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.NewListByResourceGroupPager // method. @@ -379,7 +378,7 @@ func (client *JobsClient) listByResourceGroupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -396,7 +395,7 @@ func (client *JobsClient) listByResourceGroupHandleResponse(resp *http.Response) // NewListBySubscriptionPager - Get the Container Apps Jobs in a given subscription. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - options - JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.NewListBySubscriptionPager // method. func (client *JobsClient) NewListBySubscriptionPager(options *JobsClientListBySubscriptionOptions) *runtime.Pager[JobsClientListBySubscriptionResponse] { @@ -434,7 +433,7 @@ func (client *JobsClient) listBySubscriptionCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -451,7 +450,7 @@ func (client *JobsClient) listBySubscriptionHandleResponse(resp *http.Response) // NewListDetectorsPager - Get the list of diagnostics for a Container App Job. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - options - JobsClientListDetectorsOptions contains the optional parameters for the JobsClient.NewListDetectorsPager method. @@ -498,7 +497,7 @@ func (client *JobsClient) listDetectorsCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -516,7 +515,7 @@ func (client *JobsClient) listDetectorsHandleResponse(resp *http.Response) (Jobs // ListSecrets - List secrets for a container apps job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - options - JobsClientListSecretsOptions contains the optional parameters for the JobsClient.ListSecrets method. @@ -562,7 +561,7 @@ func (client *JobsClient) listSecretsCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -580,7 +579,7 @@ func (client *JobsClient) listSecretsHandleResponse(resp *http.Response) (JobsCl // ProxyGet - Get the properties of a Container App Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - apiName - Proxy API Name for Container App Job. @@ -631,7 +630,7 @@ func (client *JobsClient) proxyGetCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -649,7 +648,7 @@ func (client *JobsClient) proxyGetHandleResponse(resp *http.Response) (JobsClien // BeginResume - Resumes a suspended job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Name of the Job. // - options - JobsClientBeginResumeOptions contains the optional parameters for the JobsClient.BeginResume method. @@ -674,7 +673,7 @@ func (client *JobsClient) BeginResume(ctx context.Context, resourceGroupName str // Resume - Resumes a suspended job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JobsClient) resume(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginResumeOptions) (*http.Response, error) { var err error const operationName = "JobsClient.BeginResume" @@ -716,7 +715,7 @@ func (client *JobsClient) resumeCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -725,7 +724,7 @@ func (client *JobsClient) resumeCreateRequest(ctx context.Context, resourceGroup // BeginStart - Start a Container Apps Job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - options - JobsClientBeginStartOptions contains the optional parameters for the JobsClient.BeginStart method. @@ -750,7 +749,7 @@ func (client *JobsClient) BeginStart(ctx context.Context, resourceGroupName stri // Start - Start a Container Apps Job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JobsClient) start(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "JobsClient.BeginStart" @@ -792,7 +791,7 @@ func (client *JobsClient) startCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Template != nil { @@ -807,7 +806,7 @@ func (client *JobsClient) startCreateRequest(ctx context.Context, resourceGroupN // BeginStopExecution - Terminates execution of a running container apps job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - jobExecutionName - Job execution name. @@ -833,7 +832,7 @@ func (client *JobsClient) BeginStopExecution(ctx context.Context, resourceGroupN // StopExecution - Terminates execution of a running container apps job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JobsClient) stopExecution(ctx context.Context, resourceGroupName string, jobName string, jobExecutionName string, options *JobsClientBeginStopExecutionOptions) (*http.Response, error) { var err error const operationName = "JobsClient.BeginStopExecution" @@ -879,7 +878,7 @@ func (client *JobsClient) stopExecutionCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -888,7 +887,7 @@ func (client *JobsClient) stopExecutionCreateRequest(ctx context.Context, resour // BeginStopMultipleExecutions - Terminates execution of a running container apps job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - options - JobsClientBeginStopMultipleExecutionsOptions contains the optional parameters for the JobsClient.BeginStopMultipleExecutions @@ -914,7 +913,7 @@ func (client *JobsClient) BeginStopMultipleExecutions(ctx context.Context, resou // StopMultipleExecutions - Terminates execution of a running container apps job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JobsClient) stopMultipleExecutions(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginStopMultipleExecutionsOptions) (*http.Response, error) { var err error const operationName = "JobsClient.BeginStopMultipleExecutions" @@ -956,7 +955,7 @@ func (client *JobsClient) stopMultipleExecutionsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -965,7 +964,7 @@ func (client *JobsClient) stopMultipleExecutionsCreateRequest(ctx context.Contex // BeginSuspend - Suspends a job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Name of the Job. // - options - JobsClientBeginSuspendOptions contains the optional parameters for the JobsClient.BeginSuspend method. @@ -990,7 +989,7 @@ func (client *JobsClient) BeginSuspend(ctx context.Context, resourceGroupName st // Suspend - Suspends a job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JobsClient) suspend(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginSuspendOptions) (*http.Response, error) { var err error const operationName = "JobsClient.BeginSuspend" @@ -1032,7 +1031,7 @@ func (client *JobsClient) suspendCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1041,7 +1040,7 @@ func (client *JobsClient) suspendCreateRequest(ctx context.Context, resourceGrou // BeginUpdate - Patches a Container Apps Job using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - jobEnvelope - Properties used to create a container apps job @@ -1066,7 +1065,7 @@ func (client *JobsClient) BeginUpdate(ctx context.Context, resourceGroupName str // Update - Patches a Container Apps Job using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *JobsClient) update(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope JobPatchProperties, options *JobsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "JobsClient.BeginUpdate" @@ -1108,7 +1107,7 @@ func (client *JobsClient) updateCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, jobEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go deleted file mode 100644 index 9f9d00919379..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go +++ /dev/null @@ -1,1482 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_ListDetectors.json -func ExampleJobsClient_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.NewJobsClient().NewListDetectorsPager("mikono-workerapp-test-rg", "mikonojob1", 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("cappjobContainerAppAvailabilityMetrics"), - // Type: to.Ptr("Microsoft.App/containerapps/detectors"), - // ID: to.Ptr("/subscriptions/f07f3711-b45e-40fe-a941-4e6d93f851e6/resourceGroups/mikono-workerapp-test-rg/providers/Microsoft.App/jobs/mikonojob1/detectors/cappjobContainerAppAvailabilityMetrics"), - // Properties: &armappcontainers.DiagnosticsProperties{ - // Dataset: []*armappcontainers.DiagnosticsDataAPIResponse{ - // }, - // Metadata: &armappcontainers.DiagnosticsDefinition{ - // Name: to.Ptr("Availability Metrics for Container App Jobs"), - // Type: to.Ptr("Analysis"), - // Author: to.Ptr(""), - // Category: to.Ptr("Availability and Performance"), - // ID: to.Ptr("cappjobContainerAppAvailabilityMetrics"), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_GetDetector.json -func ExampleJobsClient_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.NewJobsClient().GetDetector(ctx, "mikono-workerapp-test-rg", "mikonojob1", "containerappjobnetworkIO", 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("containerappjobnetworkIO"), - // Type: to.Ptr("Microsoft.App/jobs/detectors"), - // ID: to.Ptr("/subscriptions/f07f3711-b45e-40fe-a941-4e6d93f851e6/resourceGroups/mikono-workerapp-test-rg/providers/Microsoft.App/jobs/mikonojob1/detectors/containerappjobnetworkIO"), - // 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 App Job 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 Job Network Inbound and Outbound"), - // Type: to.Ptr("Detector"), - // Description: to.Ptr("This detector shows the Container App Job Network Inbound and Outbound."), - // Author: to.Ptr(""), - // Category: to.Ptr("Availability and Performance"), - // ID: to.Ptr("containerappjobnetworkIO"), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_ProxyGet.json -func ExampleJobsClient_ProxyGet() { - 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().ProxyGet(ctx, "rg", "testcontainerAppsJob0", "rootApi", 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/detectorproperties/rootApi"), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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.TriggerType("Scheduled")), - // }, - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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.TriggerType("Scheduled")), - // }, - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("24adfa4f-dedf-8dc0-ca29-b6d1a69ab319"), - // TenantID: to.Ptr("23adfa4f-eedf-1dc0-ba29-a6d1a69ab3d0"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("14adfa4f-eedf-1dc0-ba29-a6d1a69ab3df"), - // PrincipalID: to.Ptr("74adfa4f-dedf-8dc0-ca29-b6d1a69ab312"), - // }, - // }, - // }, - // Properties: &armappcontainers.JobProperties{ - // Configuration: &armappcontainers.JobConfiguration{ - // IdentitySettings: []*armappcontainers.IdentitySettings{ - // { - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - // }, - // { - // Identity: to.Ptr("system"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - // }}, - // 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"), - // }, - // VolumeMounts: []*armappcontainers.VolumeMount{ - // { - // MountPath: to.Ptr("/mnt/path1"), - // SubPath: to.Ptr("subPath1"), - // VolumeName: to.Ptr("azurefile"), - // }, - // { - // MountPath: to.Ptr("/mnt/path2"), - // SubPath: to.Ptr("subPath2"), - // VolumeName: to.Ptr("nfsazurefile"), - // }}, - // }}, - // 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"), - // }, - // }}, - // Volumes: []*armappcontainers.Volume{ - // { - // Name: to.Ptr("azurefile"), - // StorageName: to.Ptr("storage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - // }, - // { - // Name: to.Ptr("nfsazurefile"), - // StorageName: to.Ptr("nfsStorage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_CreateorUpdate.json -func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJob() { - 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"), - Identity: &armappcontainers.ManagedServiceIdentity{ - Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {}, - }, - }, - Properties: &armappcontainers.JobProperties{ - Configuration: &armappcontainers.JobConfiguration{ - IdentitySettings: []*armappcontainers.IdentitySettings{ - { - Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - }, - { - Identity: to.Ptr("system"), - Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - }}, - 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"), - VolumeMounts: []*armappcontainers.VolumeMount{ - { - MountPath: to.Ptr("/mnt/path1"), - SubPath: to.Ptr("subPath1"), - VolumeName: to.Ptr("azurefile"), - }, - { - MountPath: to.Ptr("/mnt/path2"), - SubPath: to.Ptr("subPath2"), - VolumeName: to.Ptr("nfsazurefile"), - }}, - 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"), - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("24adfa4f-dedf-8dc0-ca29-b6d1a69ab319"), - // TenantID: to.Ptr("23adfa4f-eedf-1dc0-ba29-a6d1a69ab3d0"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("14adfa4f-eedf-1dc0-ba29-a6d1a69ab3df"), - // PrincipalID: to.Ptr("74adfa4f-dedf-8dc0-ca29-b6d1a69ab312"), - // }, - // }, - // }, - // Properties: &armappcontainers.JobProperties{ - // Configuration: &armappcontainers.JobConfiguration{ - // IdentitySettings: []*armappcontainers.IdentitySettings{ - // { - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - // }, - // { - // Identity: to.Ptr("system"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - // }}, - // 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"), - // }, - // VolumeMounts: []*armappcontainers.VolumeMount{ - // { - // MountPath: to.Ptr("/mnt/path1"), - // SubPath: to.Ptr("subPath1"), - // VolumeName: to.Ptr("azurefile"), - // }, - // { - // MountPath: to.Ptr("/mnt/path2"), - // SubPath: to.Ptr("subPath2"), - // VolumeName: to.Ptr("nfsazurefile"), - // }}, - // 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"), - // }, - // }}, - // Volumes: []*armappcontainers.Volume{ - // { - // Name: to.Ptr("azurefile"), - // StorageName: to.Ptr("storage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - // }, - // { - // Name: to.Ptr("nfsazurefile"), - // StorageName: to.Ptr("nfsStorage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_CreateorUpdate_ConnectedEnvironment.json -func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobOnAConnectedEnvironment() { - 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"), - ExtendedLocation: &armappcontainers.ExtendedLocation{ - Name: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation"), - Type: to.Ptr(armappcontainers.ExtendedLocationTypesCustomLocation), - }, - 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/connectedEnvironments/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"), - // ExtendedLocation: &armappcontainers.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation"), - // Type: to.Ptr(armappcontainers.ExtendedLocationTypesCustomLocation), - // }, - // 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/connectedEnvironments/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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_CreateorUpdate_EventTrigger.json -func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEventDrivenTrigger() { - 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"), - Identity: &armappcontainers.ManagedServiceIdentity{ - Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {}, - }, - }, - Properties: &armappcontainers.JobProperties{ - Configuration: &armappcontainers.JobConfiguration{ - EventTriggerConfig: &armappcontainers.JobConfigurationEventTriggerConfig{ - Parallelism: to.Ptr[int32](4), - ReplicaCompletionCount: to.Ptr[int32](1), - Scale: &armappcontainers.JobScale{ - MaxExecutions: to.Ptr[int32](5), - MinExecutions: to.Ptr[int32](1), - PollingInterval: to.Ptr[int32](40), - Rules: []*armappcontainers.JobScaleRule{ - { - Name: to.Ptr("servicebuscalingrule"), - Type: to.Ptr("azure-servicebus"), - Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - Metadata: map[string]any{ - "topicName": "my-topic", - }, - }}, - }, - }, - ReplicaRetryLimit: to.Ptr[int32](10), - ReplicaTimeout: to.Ptr[int32](10), - TriggerType: to.Ptr(armappcontainers.TriggerTypeEvent), - }, - 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"), - }}, - 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"), - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("14adfa4f-eedf-1dc0-ba29-a6d1a69ab3df"), - // PrincipalID: to.Ptr("74adfa4f-dedf-8dc0-ca29-b6d1a69ab312"), - // }, - // }, - // }, - // Properties: &armappcontainers.JobProperties{ - // Configuration: &armappcontainers.JobConfiguration{ - // EventTriggerConfig: &armappcontainers.JobConfigurationEventTriggerConfig{ - // Parallelism: to.Ptr[int32](4), - // ReplicaCompletionCount: to.Ptr[int32](1), - // Scale: &armappcontainers.JobScale{ - // MaxExecutions: to.Ptr[int32](5), - // MinExecutions: to.Ptr[int32](1), - // PollingInterval: to.Ptr[int32](20), - // Rules: []*armappcontainers.JobScaleRule{ - // { - // Name: to.Ptr("servicebuscalingrule"), - // Type: to.Ptr("azure-servicebus"), - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Metadata: map[string]any{ - // "topicName": "my-topic", - // }, - // }}, - // }, - // }, - // ReplicaRetryLimit: to.Ptr[int32](10), - // ReplicaTimeout: to.Ptr[int32](10), - // TriggerType: to.Ptr(armappcontainers.TriggerTypeEvent), - // }, - // 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"), - // }, - // }}, - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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.JobsClientBeginStartOptions{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"), - }, - }}, - }, - }) - 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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", 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"), - // Properties: &armappcontainers.JobExecutionProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:47:30.000Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:37:30.000Z"); return t}()), - // Status: to.Ptr(armappcontainers.JobExecutionRunningStateRunning), - // }, - // }, - // { - // Name: to.Ptr("jobExecution-27944452"), - // Properties: &armappcontainers.JobExecutionProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T21:47:30.000Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T21:37:30.000Z"); return t}()), - // Status: to.Ptr(armappcontainers.JobExecutionRunningStateRunning), - // }, - // }, - // { - // Name: to.Ptr("jobExecution-27944453"), - // Properties: &armappcontainers.JobExecutionProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T22:47:30.000Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T22:37:30.000Z"); return t}()), - // Status: to.Ptr(armappcontainers.JobExecutionRunningStateRunning), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Jobs_Resume.json -func ExampleJobsClient_BeginResume() { - 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().BeginResume(ctx, "rg", "testcontainerAppsJob0", 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{ - // IdentitySettings: []*armappcontainers.IdentitySettings{ - // { - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - // }, - // { - // Identity: to.Ptr("system"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - // }}, - // 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), - // RunningState: to.Ptr(armappcontainers.JobRunningStateReady), - // 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"), - // }, - // VolumeMounts: []*armappcontainers.VolumeMount{ - // { - // MountPath: to.Ptr("/mnt/path1"), - // SubPath: to.Ptr("subPath1"), - // VolumeName: to.Ptr("azurefile"), - // }, - // { - // MountPath: to.Ptr("/mnt/path2"), - // SubPath: to.Ptr("subPath2"), - // VolumeName: to.Ptr("nfsazurefile"), - // }}, - // }}, - // 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"), - // }, - // }}, - // Volumes: []*armappcontainers.Volume{ - // { - // Name: to.Ptr("azurefile"), - // StorageName: to.Ptr("storage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - // }, - // { - // Name: to.Ptr("nfsazurefile"), - // StorageName: to.Ptr("nfsStorage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Jobs_Suspend.json -func ExampleJobsClient_BeginSuspend() { - 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().BeginSuspend(ctx, "rg", "testcontainerAppsJob0", 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{ - // IdentitySettings: []*armappcontainers.IdentitySettings{ - // { - // Identity: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleAll), - // }, - // { - // Identity: to.Ptr("system"), - // Lifecycle: to.Ptr(armappcontainers.IdentitySettingsLifeCycleInit), - // }}, - // 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), - // RunningState: to.Ptr(armappcontainers.JobRunningStateSuspended), - // 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"), - // }, - // VolumeMounts: []*armappcontainers.VolumeMount{ - // { - // MountPath: to.Ptr("/mnt/path1"), - // SubPath: to.Ptr("subPath1"), - // VolumeName: to.Ptr("azurefile"), - // }, - // { - // MountPath: to.Ptr("/mnt/path2"), - // SubPath: to.Ptr("subPath2"), - // VolumeName: to.Ptr("nfsazurefile"), - // }}, - // }}, - // 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"), - // }, - // }}, - // Volumes: []*armappcontainers.Volume{ - // { - // Name: to.Ptr("azurefile"), - // StorageName: to.Ptr("storage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeAzureFile), - // }, - // { - // Name: to.Ptr("nfsazurefile"), - // StorageName: to.Ptr("nfsStorage"), - // StorageType: to.Ptr(armappcontainers.StorageTypeNfsAzureFile), - // }}, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go index aeedbecf99f3..38e80796f640 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -46,7 +45,7 @@ func NewJobsExecutionsClient(subscriptionID string, credential azcore.TokenCrede // NewListPager - Get a Container Apps Job's executions // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - options - JobsExecutionsClientListOptions contains the optional parameters for the JobsExecutionsClient.NewListPager method. @@ -96,7 +95,7 @@ func (client *JobsExecutionsClient) listCreateRequest(ctx context.Context, resou if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go deleted file mode 100644 index a0766b317106..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go +++ /dev/null @@ -1,98 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - // Properties: &armappcontainers.JobExecutionProperties{ - // DetailedStatus: &armappcontainers.ExecutionStatus{ - // Replicas: []*armappcontainers.ReplicaExecutionStatus{ - // { - // Name: to.Ptr("testcontainerappsjob0-0"), - // Containers: []*armappcontainers.ContainerExecutionStatus{ - // { - // Name: to.Ptr("container1"), - // AdditionalInformation: to.Ptr("Completed"), - // Code: to.Ptr[int32](0), - // Status: to.Ptr("Succeeded"), - // }, - // { - // Name: to.Ptr("container2"), - // AdditionalInformation: to.Ptr("Completed"), - // Code: to.Ptr[int32](0), - // Status: to.Ptr("Succeeded"), - // }}, - // }}, - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:47:30.000Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-13T20:37:30.000Z"); 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.5), - // Memory: to.Ptr("1Gi"), - // }, - // }}, - // 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.5), - // Memory: to.Ptr("1Gi"), - // }, - // }}, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client.go index 20e0e8d952b5..5a7a53cb69b8 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // LogicAppsClient contains the methods for the LogicApps group. @@ -47,7 +46,7 @@ func NewLogicAppsClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Create or update a Logic App extension resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - logicAppName - Name of the Logic App, the extension resource. @@ -100,7 +99,7 @@ func (client *LogicAppsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -121,7 +120,7 @@ func (client *LogicAppsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes a Logic App extension resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - logicAppName - Name of the Logic App, the extension resource. @@ -171,7 +170,7 @@ func (client *LogicAppsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +179,7 @@ func (client *LogicAppsClient) deleteCreateRequest(ctx context.Context, resource // DeployWorkflowArtifacts - Creates or updates the artifacts for the logic app // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - logicAppName - Name of the Logic App, the extension resource. @@ -231,7 +230,7 @@ func (client *LogicAppsClient) deployWorkflowArtifactsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.WorkflowArtifacts != nil { @@ -246,7 +245,7 @@ func (client *LogicAppsClient) deployWorkflowArtifactsCreateRequest(ctx context. // Get - Gets a logic app extension resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - logicAppName - Name of the Logic App, the extension resource. @@ -297,7 +296,7 @@ func (client *LogicAppsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -315,7 +314,7 @@ func (client *LogicAppsClient) getHandleResponse(resp *http.Response) (LogicApps // GetWorkflow - Get workflow information by its name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - logicAppName - Name of the Logic App, the extension resource. @@ -371,7 +370,7 @@ func (client *LogicAppsClient) getWorkflowCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -389,7 +388,7 @@ func (client *LogicAppsClient) getWorkflowHandleResponse(resp *http.Response) (L // Invoke - Proxies a the API call to the logic app backed by the container app. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - logicAppName - Name of the LogicApp App, the extension resource. @@ -442,7 +441,7 @@ func (client *LogicAppsClient) invokeCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["x-ms-logicApps-proxy-method"] = []string{string(xmsLogicAppsProxyMethod)} @@ -461,7 +460,7 @@ func (client *LogicAppsClient) invokeHandleResponse(resp *http.Response) (LogicA // NewListWorkflowsPager - List the workflows for a logic app. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - logicAppName - Name of the Logic App, the extension resource. @@ -514,7 +513,7 @@ func (client *LogicAppsClient) listWorkflowsCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -532,7 +531,7 @@ func (client *LogicAppsClient) listWorkflowsHandleResponse(resp *http.Response) // ListWorkflowsConnections - Gets logic app's connections. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - containerAppName - Name of the Container App. // - logicAppName - Name of the Logic App, the extension resource. @@ -584,7 +583,7 @@ func (client *LogicAppsClient) listWorkflowsConnectionsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client_example_test.go deleted file mode 100644 index c655b9398dd1..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client_example_test.go +++ /dev/null @@ -1,384 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Get.json -func ExampleLogicAppsClient_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.NewLogicAppsClient().Get(ctx, "examplerg", "testcontainerApp0", "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.LogicApp = armappcontainers.LogicApp{ - // Name: to.Ptr("testcontainerApp0"), - // Type: to.Ptr("Microsoft.App/logicApps"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/containerApps/testcontainerApp0/providers/Microsoft.App/logicApps/testcontainerApp0"), - // Properties: map[string]any{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Create.json -func ExampleLogicAppsClient_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.NewLogicAppsClient().CreateOrUpdate(ctx, "examplerg", "testcontainerApp0", "testcontainerApp0", armappcontainers.LogicApp{ - Properties: map[string]any{}, - }, 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.LogicApp = armappcontainers.LogicApp{ - // Name: to.Ptr("testcontainerApp0"), - // Type: to.Ptr("Microsoft.App/logicApps"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/containerApps/testcontainerApp0/providers/Microsoft.App/logicApps/testcontainerApp0"), - // Properties: map[string]any{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Delete.json -func ExampleLogicAppsClient_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.NewLogicAppsClient().Delete(ctx, "examplerg", "testcontainerApp0", "testcontainerApp0", 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_ListWorkflows.json -func ExampleLogicAppsClient_NewListWorkflowsPager() { - 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.NewLogicAppsClient().NewListWorkflowsPager("examplerg", "testcontainerApp0", "testcontainerApp0", 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.WorkflowEnvelopeCollection = armappcontainers.WorkflowEnvelopeCollection{ - // Value: []*armappcontainers.WorkflowEnvelope{ - // { - // Name: to.Ptr("testcontainerApp0/a1"), - // Type: to.Ptr("Microsoft.App/logicApps/workflows"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/containerApps/testcontainerApp0/providers/Microsoft.App/logicApps/testcontainerApp0/workflows/a1"), - // Kind: to.Ptr("Stateful"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.WorkflowEnvelopeProperties{ - // FlowState: to.Ptr(armappcontainers.WorkflowStateEnabled), - // Health: &armappcontainers.WorkflowHealth{ - // State: to.Ptr(armappcontainers.WorkflowHealthStateHealthy), - // }, - // }, - // }, - // { - // Name: to.Ptr("testcontainerApp0/stateful2"), - // Type: to.Ptr("Microsoft.App/logicApps/workflows"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/containerApps/testcontainerApp0/providers/Microsoft.App/logicApps/testcontainerApp0/workflows/stateful2"), - // Kind: to.Ptr("Stateful"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.WorkflowEnvelopeProperties{ - // FlowState: to.Ptr(armappcontainers.WorkflowStateEnabled), - // Health: &armappcontainers.WorkflowHealth{ - // Error: &armappcontainers.ErrorEntity{ - // Code: to.Ptr("InvalidWorkflowJson"), - // Message: to.Ptr("Invalid character after parsing property name. Expected ':' but got: \". Path '', line 2, position 2."), - // }, - // State: to.Ptr(armappcontainers.WorkflowHealthStateUnhealthy), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_GetWorkflow.json -func ExampleLogicAppsClient_GetWorkflow() { - 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.NewLogicAppsClient().GetWorkflow(ctx, "examplerg", "testcontainerApp0", "testcontainerApp0", "stateful1", 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.WorkflowEnvelope = armappcontainers.WorkflowEnvelope{ - // Name: to.Ptr("testcontainerApp0/stateful1"), - // Type: to.Ptr("Microsoft.App/logicApps/workflows"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/containerApps/testcontainerApp0/providers/Microsoft.App/logicApps/testcontainerApp0/workflows/stateful1"), - // Kind: to.Ptr("Stateful"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.WorkflowEnvelopeProperties{ - // Files: map[string]any{ - // "connections.json":map[string]any{ - // "managedApiConnections":map[string]any{ - // "office365":map[string]any{ - // "api":map[string]any{ - // "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.Web/locations/brazilsouth/managedApis/office365", - // }, - // "authentication":map[string]any{ - // "type": "Raw", - // "parameter": "@appsetting('office365-connectionKey')", - // "scheme": "Key", - // }, - // "connection":map[string]any{ - // "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/connections/office365-1", - // }, - // "connectionRuntimeUrl": "string", - // }, - // }, - // }, - // "workflow.json":map[string]any{ - // "definition":map[string]any{ - // "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", - // "actions":map[string]any{ - // }, - // "contentVersion": "1.0.0.0", - // "outputs":map[string]any{ - // }, - // "parameters":map[string]any{ - // }, - // "triggers":map[string]any{ - // }, - // }, - // }, - // }, - // FlowState: to.Ptr(armappcontainers.WorkflowStateEnabled), - // Health: &armappcontainers.WorkflowHealth{ - // State: to.Ptr(armappcontainers.WorkflowHealthStateHealthy), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_DeleteDeployWorkflowArtifacts.json -func ExampleLogicAppsClient_DeployWorkflowArtifacts_deleteWorkflowArtifacts() { - 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.NewLogicAppsClient().DeployWorkflowArtifacts(ctx, "testrg123", "testapp2", "testapp2", &armappcontainers.LogicAppsClientDeployWorkflowArtifactsOptions{WorkflowArtifacts: &armappcontainers.WorkflowArtifacts{ - FilesToDelete: []*string{ - to.Ptr("test/workflow.json"), - to.Ptr("test/")}, - }, - }) - 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_PostDeployWorkflowArtifacts.json -func ExampleLogicAppsClient_DeployWorkflowArtifacts_deploysWorkflowArtifacts() { - 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.NewLogicAppsClient().DeployWorkflowArtifacts(ctx, "testrg123", "testapp2", "testapp2", &armappcontainers.LogicAppsClientDeployWorkflowArtifactsOptions{WorkflowArtifacts: &armappcontainers.WorkflowArtifacts{ - AppSettings: map[string]any{ - "eventHub_connectionString": "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=EXAMPLE1a2b3c4d5e6fEXAMPLE=", - }, - Files: map[string]any{ - "connections.json": map[string]any{ - "managedApiConnections": map[string]any{}, - "serviceProviderConnections": map[string]any{ - "eventHub": map[string]any{ - "displayName": "example1", - "parameterValues": map[string]any{ - "connectionString": "@appsetting('eventHub_connectionString')", - }, - "serviceProvider": map[string]any{ - "id": "/serviceProviders/eventHub", - }, - }, - }, - }, - "test1/workflow.json": map[string]any{ - "definition": map[string]any{ - "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", - "actions": map[string]any{}, - "contentVersion": "1.0.0.0", - "outputs": map[string]any{}, - "triggers": map[string]any{ - "When_events_are_available_in_Event_hub": map[string]any{ - "type": "ServiceProvider", - "inputs": map[string]any{ - "parameters": map[string]any{ - "eventHubName": "test123", - }, - "serviceProviderConfiguration": map[string]any{ - "operationId": "receiveEvents", - "connectionName": "eventHub", - "serviceProviderId": "/serviceProviders/eventHub", - }, - }, - "splitOn": "@triggerOutputs()?['body']", - }, - }, - }, - "kind": "Stateful", - }, - }, - }, - }) - 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_ListConnections.json -func ExampleLogicAppsClient_ListWorkflowsConnections() { - 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.NewLogicAppsClient().ListWorkflowsConnections(ctx, "testrg123", "testapp2", "testapp2", 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.WorkflowEnvelope = armappcontainers.WorkflowEnvelope{ - // Name: to.Ptr("testapp2/connections"), - // Type: to.Ptr("Microsoft.App/logicApps/workflowsconfiguration"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/containerApps/testapp2/providers/Microsoft.App/logicApps/testapp2/workflowconfigurations/connections"), - // Location: to.Ptr("East US"), - // Properties: &armappcontainers.WorkflowEnvelopeProperties{ - // Files: map[string]any{ - // "connections.json":map[string]any{ - // "managedApiConnections":map[string]any{ - // "office365":map[string]any{ - // "api":map[string]any{ - // "id": "string", - // }, - // "authentication":map[string]any{ - // "type": "Raw", - // "parameter": "@appsetting('office365-connectionKey')", - // "scheme": "Key", - // }, - // "connection":map[string]any{ - // "id": "string", - // }, - // "connectionRuntimeUrl": "string", - // }, - // }, - // }, - // }, - // Health: &armappcontainers.WorkflowHealth{ - // State: to.Ptr(armappcontainers.WorkflowHealthStateHealthy), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_ListCallbackURL.json -func ExampleLogicAppsClient_Invoke() { - 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.NewLogicAppsClient().Invoke(ctx, "testrg123", "testapp2", "testapp2", "", armappcontainers.LogicAppsProxyMethodPOST, 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.Interface = map[string]any{ - // "method": "POST", - // "basePath": "https://testapp2.livelyriver-730e4fd9.eastasia.azurecontainerapps.io /api/test/triggers/When_a_HTTP_request_is_received/invoke", - // "queries":map[string]any{ - // "api-version": "2022-05-01", - // "sig": "IxEQ_ygZf6WNEQCbjV0Vs6p6Y4DyNEJVAa86U5B4xhk", - // "sp": "/triggers/When_a_HTTP_request_is_received/run", - // "sv": "1.0", - // }, - // "value": "https://testapp2.livelyriver-730e4fd9.eastasia.azurecontainerapps.io:443/api/test/triggers/When_a_HTTP_request_is_received/invoke?api-version=2022-05-01&sp=%2Ftriggers%2FWhen_a_HTTP_request_is_received%2Frun&sv=1.0&sig= ", - // } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/maintenanceconfigurations_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/maintenanceconfigurations_client.go new file mode 100644 index 000000000000..aee54ffc91c2 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/maintenanceconfigurations_client.go @@ -0,0 +1,313 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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" +) + +// MaintenanceConfigurationsClient contains the methods for the MaintenanceConfigurations group. +// Don't use this type directly, use NewMaintenanceConfigurationsClient() instead. +type MaintenanceConfigurationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMaintenanceConfigurationsClient creates a new instance of MaintenanceConfigurationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMaintenanceConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MaintenanceConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MaintenanceConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update the maintenance configuration for Managed Environment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - The name of the Managed Environment. +// - configName - The name of the maintenance configuration. +// - maintenanceConfigurationEnvelope - Parameters to set the maintenance configuration for ManagedEnvironment . +// - options - MaintenanceConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the MaintenanceConfigurationsClient.CreateOrUpdate +// method. +func (client *MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, configName string, maintenanceConfigurationEnvelope MaintenanceConfigurationResource, options *MaintenanceConfigurationsClientCreateOrUpdateOptions) (MaintenanceConfigurationsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "MaintenanceConfigurationsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, environmentName, configName, maintenanceConfigurationEnvelope, options) + if err != nil { + return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *MaintenanceConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, configName string, maintenanceConfigurationEnvelope MaintenanceConfigurationResource, options *MaintenanceConfigurationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations/{configName}" + 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 configName == "" { + return nil, errors.New("parameter configName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configName}", url.PathEscape(configName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, maintenanceConfigurationEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *MaintenanceConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (MaintenanceConfigurationsClientCreateOrUpdateResponse, error) { + result := MaintenanceConfigurationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfigurationResource); err != nil { + return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the maintenance configuration of a ManagedEnvironment . +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - The name of the Managed Environment. +// - configName - The name of the maintenance configuration. +// - options - MaintenanceConfigurationsClientDeleteOptions contains the optional parameters for the MaintenanceConfigurationsClient.Delete +// method. +func (client *MaintenanceConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, environmentName string, configName string, options *MaintenanceConfigurationsClientDeleteOptions) (MaintenanceConfigurationsClientDeleteResponse, error) { + var err error + const operationName = "MaintenanceConfigurationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, environmentName, configName, options) + if err != nil { + return MaintenanceConfigurationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MaintenanceConfigurationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return MaintenanceConfigurationsClientDeleteResponse{}, err + } + return MaintenanceConfigurationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, configName string, options *MaintenanceConfigurationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations/{configName}" + 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 configName == "" { + return nil, errors.New("parameter configName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configName}", url.PathEscape(configName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the maintenance configuration of a ManagedEnvironment . +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - The name of the Managed Environment. +// - configName - The name of the maintenance configuration. +// - options - MaintenanceConfigurationsClientGetOptions contains the optional parameters for the MaintenanceConfigurationsClient.Get +// method. +func (client *MaintenanceConfigurationsClient) Get(ctx context.Context, resourceGroupName string, environmentName string, configName string, options *MaintenanceConfigurationsClientGetOptions) (MaintenanceConfigurationsClientGetResponse, error) { + var err error + const operationName = "MaintenanceConfigurationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, environmentName, configName, options) + if err != nil { + return MaintenanceConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MaintenanceConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MaintenanceConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MaintenanceConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, configName string, options *MaintenanceConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations/{configName}" + 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 configName == "" { + return nil, errors.New("parameter configName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configName}", url.PathEscape(configName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MaintenanceConfigurationsClient) getHandleResponse(resp *http.Response) (MaintenanceConfigurationsClientGetResponse, error) { + result := MaintenanceConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfigurationResource); err != nil { + return MaintenanceConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all maintenance configurations in the specified Managed Environment. +// +// Generated from API version 2024-10-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - The name of the Managed Environment. +// - options - MaintenanceConfigurationsClientListOptions contains the optional parameters for the MaintenanceConfigurationsClient.NewListPager +// method. +func (client *MaintenanceConfigurationsClient) NewListPager(resourceGroupName string, environmentName string, options *MaintenanceConfigurationsClientListOptions) *runtime.Pager[MaintenanceConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[MaintenanceConfigurationsClientListResponse]{ + More: func(page MaintenanceConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MaintenanceConfigurationsClientListResponse) (MaintenanceConfigurationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MaintenanceConfigurationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, environmentName, options) + }, nil) + if err != nil { + return MaintenanceConfigurationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *MaintenanceConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *MaintenanceConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations" + 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", "2024-10-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MaintenanceConfigurationsClient) listHandleResponse(resp *http.Response) (MaintenanceConfigurationsClientListResponse, error) { + result := MaintenanceConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfigurationCollection); err != nil { + return MaintenanceConfigurationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go index 61abb6a68242..94acfd2731c6 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -47,7 +46,7 @@ func NewManagedCertificatesClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Create or Update a Managed Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -74,7 +73,7 @@ func (client *ManagedCertificatesClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create or Update a Managed Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ManagedCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, managedCertificateName string, options *ManagedCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedCertificatesClient.BeginCreateOrUpdate" @@ -120,7 +119,7 @@ func (client *ManagedCertificatesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.ManagedCertificateEnvelope != nil { @@ -135,7 +134,7 @@ func (client *ManagedCertificatesClient) createOrUpdateCreateRequest(ctx context // Delete - Deletes the specified Managed Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -186,7 +185,7 @@ func (client *ManagedCertificatesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +194,7 @@ func (client *ManagedCertificatesClient) deleteCreateRequest(ctx context.Context // Get - Get the specified Managed Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -246,7 +245,7 @@ func (client *ManagedCertificatesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +262,7 @@ func (client *ManagedCertificatesClient) getHandleResponse(resp *http.Response) // NewListPager - Get the Managed Certificates in a given managed environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -311,7 +310,7 @@ func (client *ManagedCertificatesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +328,7 @@ func (client *ManagedCertificatesClient) listHandleResponse(resp *http.Response) // 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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -382,7 +381,7 @@ func (client *ManagedCertificatesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, managedCertificateEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go deleted file mode 100644 index fee377ba1ccc..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go +++ /dev/null @@ -1,200 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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 index 8bf0c7813b74..925d02bc9400 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -47,7 +46,7 @@ func NewManagedEnvironmentDiagnosticsClient(subscriptionID string, credential az // 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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -99,7 +98,7 @@ func (client *ManagedEnvironmentDiagnosticsClient) getDetectorCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +116,7 @@ func (client *ManagedEnvironmentDiagnosticsClient) getDetectorHandleResponse(res // 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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -164,7 +163,7 @@ func (client *ManagedEnvironmentDiagnosticsClient) listDetectorsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go deleted file mode 100644 index 6d4d02796d5d..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go +++ /dev/null @@ -1,135 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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/managedenvironmentprivateendpointconnections_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client.go index 6bc7c941c343..b1568b0a7139 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ManagedEnvironmentPrivateEndpointConnectionsClient contains the methods for the ManagedEnvironmentPrivateEndpointConnections group. @@ -47,7 +46,7 @@ func NewManagedEnvironmentPrivateEndpointConnectionsClient(subscriptionID string // BeginCreateOrUpdate - Update the state of a private endpoint connection for a given managed environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -74,7 +73,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) BeginCreateOrU // CreateOrUpdate - Update the state of a private endpoint connection for a given managed environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, privateEndpointConnectionEnvelope PrivateEndpointConnection, options *ManagedEnvironmentPrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedEnvironmentPrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -120,7 +119,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) createOrUpdate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, privateEndpointConnectionEnvelope); err != nil { @@ -132,7 +131,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) createOrUpdate // BeginDelete - Delete a private endpoint connection for a given managed environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -158,7 +157,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) BeginDelete(ct // Delete - Delete a private endpoint connection for a given managed environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, options *ManagedEnvironmentPrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ManagedEnvironmentPrivateEndpointConnectionsClient.BeginDelete" @@ -204,7 +203,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) deleteCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +212,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) deleteCreateRe // Get - Get a private endpoint connection for a given managed environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -265,7 +264,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) getCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +281,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) getHandleRespo // NewListPager - List private endpoint connections for a given managed environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - options - ManagedEnvironmentPrivateEndpointConnectionsClientListOptions contains the optional parameters for the ManagedEnvironmentPrivateEndpointConnectionsClient.NewListPager @@ -330,7 +329,7 @@ func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) listCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client_example_test.go deleted file mode 100644 index 8a79a75723e2..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client_example_test.go +++ /dev/null @@ -1,187 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_List.json -func ExampleManagedEnvironmentPrivateEndpointConnectionsClient_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.NewManagedEnvironmentPrivateEndpointConnectionsClient().NewListPager("examplerg", "managedEnv", 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.PrivateEndpointConnectionListResult = armappcontainers.PrivateEndpointConnectionListResult{ - // Value: []*armappcontainers.PrivateEndpointConnection{ - // { - // Name: to.Ptr("jlaw-demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/privateEndpointConenctions/jlaw-demo1"), - // Properties: &armappcontainers.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("managedEnvironments")}, - // PrivateEndpoint: &armappcontainers.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/pltest"), - // }, - // PrivateLinkServiceConnectionState: &armappcontainers.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armappcontainers.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armappcontainers.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("jlaw-demo2"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/privateEndpointConenctions/jlaw-demo2"), - // Properties: &armappcontainers.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("managedEnvironments")}, - // PrivateEndpoint: &armappcontainers.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/pltest"), - // }, - // PrivateLinkServiceConnectionState: &armappcontainers.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armappcontainers.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armappcontainers.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Get.json -func ExampleManagedEnvironmentPrivateEndpointConnectionsClient_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.NewManagedEnvironmentPrivateEndpointConnectionsClient().Get(ctx, "examplerg", "managedEnv", "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.PrivateEndpointConnection = armappcontainers.PrivateEndpointConnection{ - // Name: to.Ptr("jlaw-demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/privateEndpointConenctions/jlaw-demo1"), - // Properties: &armappcontainers.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("managedEnvironments")}, - // PrivateEndpoint: &armappcontainers.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/pltest"), - // }, - // PrivateLinkServiceConnectionState: &armappcontainers.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armappcontainers.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armappcontainers.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_CreateOrUpdate.json -func ExampleManagedEnvironmentPrivateEndpointConnectionsClient_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.NewManagedEnvironmentPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "examplerg", "managedEnv", "jlaw-demo1", armappcontainers.PrivateEndpointConnection{ - Properties: &armappcontainers.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armappcontainers.PrivateLinkServiceConnectionState{ - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armappcontainers.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, 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.PrivateEndpointConnection = armappcontainers.PrivateEndpointConnection{ - // Name: to.Ptr("jlaw-demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/privateEndpointConenctions/jlaw-demo1"), - // Properties: &armappcontainers.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("managedEnvironments")}, - // PrivateEndpoint: &armappcontainers.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/pltest"), - // }, - // PrivateLinkServiceConnectionState: &armappcontainers.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armappcontainers.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armappcontainers.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Delete.json -func ExampleManagedEnvironmentPrivateEndpointConnectionsClient_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.NewManagedEnvironmentPrivateEndpointConnectionsClient().BeginDelete(ctx, "examplerg", "managedEnv", "jlaw-demo1", 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) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client.go index 0fd654634961..77f0ea0ae05b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ManagedEnvironmentPrivateLinkResourcesClient contains the methods for the ManagedEnvironmentPrivateLinkResources group. @@ -46,7 +45,7 @@ func NewManagedEnvironmentPrivateLinkResourcesClient(subscriptionID string, cred // NewListPager - List private link resources for a given managed environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Managed Environment. // - options - ManagedEnvironmentPrivateLinkResourcesClientListOptions contains the optional parameters for the ManagedEnvironmentPrivateLinkResourcesClient.NewListPager @@ -94,7 +93,7 @@ func (client *ManagedEnvironmentPrivateLinkResourcesClient) listCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client_example_test.go deleted file mode 100644 index 31b687d7c2aa..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client_example_test.go +++ /dev/null @@ -1,58 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateLinkResources_List.json -func ExampleManagedEnvironmentPrivateLinkResourcesClient_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.NewManagedEnvironmentPrivateLinkResourcesClient().NewListPager("examplerg", "managedEnv", 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.PrivateLinkResourceListResult = armappcontainers.PrivateLinkResourceListResult{ - // Value: []*armappcontainers.PrivateLinkResource{ - // { - // Name: to.Ptr("managedEnvironments"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/privateLinkResources"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/privateLinkResources/managedEnvironments"), - // Properties: &armappcontainers.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("managedEnvironments"), - // RequiredMembers: []*string{ - // to.Ptr("managedEnvironments")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.northcentralusstage.azurecontainerapps.io")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go index 8594f861c6df..75488628f70e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ManagedEnvironmentsClient contains the methods for the ManagedEnvironments group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - environmentEnvelope - Configuration details of the Environment. @@ -73,7 +72,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ManagedEnvironmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedEnvironmentsClient.BeginCreateOrUpdate" @@ -115,7 +114,7 @@ func (client *ManagedEnvironmentsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, environmentEnvelope); err != nil { @@ -127,7 +126,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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -152,7 +151,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ManagedEnvironmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ManagedEnvironmentsClient.BeginDelete" @@ -194,7 +193,7 @@ func (client *ManagedEnvironmentsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +202,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -249,7 +248,7 @@ func (client *ManagedEnvironmentsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +266,7 @@ func (client *ManagedEnvironmentsClient) getHandleResponse(resp *http.Response) // GetAuthToken - Checks if resource name is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -314,7 +313,7 @@ func (client *ManagedEnvironmentsClient) getAuthTokenCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +330,7 @@ func (client *ManagedEnvironmentsClient) getAuthTokenHandleResponse(resp *http.R // NewListByResourceGroupPager - Get all the Managed Environments in a resource group. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ManagedEnvironmentsClientListByResourceGroupOptions contains the optional parameters for the ManagedEnvironmentsClient.NewListByResourceGroupPager // method. @@ -374,7 +373,7 @@ func (client *ManagedEnvironmentsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -391,7 +390,7 @@ func (client *ManagedEnvironmentsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Get all Managed Environments for a subscription. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - options - ManagedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ManagedEnvironmentsClient.NewListBySubscriptionPager // method. func (client *ManagedEnvironmentsClient) NewListBySubscriptionPager(options *ManagedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ManagedEnvironmentsClientListBySubscriptionResponse] { @@ -429,7 +428,7 @@ func (client *ManagedEnvironmentsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -446,7 +445,7 @@ func (client *ManagedEnvironmentsClient) listBySubscriptionHandleResponse(resp * // NewListWorkloadProfileStatesPager - Get all workload Profile States for a Managed Environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -494,7 +493,7 @@ func (client *ManagedEnvironmentsClient) listWorkloadProfileStatesCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -512,7 +511,7 @@ func (client *ManagedEnvironmentsClient) listWorkloadProfileStatesHandleResponse // BeginUpdate - Patches a Managed Environment using JSON Merge Patch // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - environmentEnvelope - Configuration details of the Environment. @@ -538,7 +537,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview func (client *ManagedEnvironmentsClient) update(ctx context.Context, resourceGroupName string, environmentName string, environmentEnvelope ManagedEnvironment, options *ManagedEnvironmentsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedEnvironmentsClient.BeginUpdate" @@ -580,7 +579,7 @@ func (client *ManagedEnvironmentsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, environmentEnvelope); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go deleted file mode 100644 index 16a949dae5b6..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go +++ /dev/null @@ -1,834 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_ListBySubscription.json -func ExampleManagedEnvironmentsClient_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.NewManagedEnvironmentsClient().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.ManagedEnvironmentsCollection = armappcontainers.ManagedEnvironmentsCollection{ - // Value: []*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:00.000Z"); 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"), - // EnableFips: to.Ptr(true), - // 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), - // }, - // }, - // { - // Name: to.Ptr("demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/DemoRG/providers/Microsoft.App/managedEnvironments/demo1"), - // Location: to.Ptr("North Central US"), - // Tags: map[string]*string{ - // }, - // Properties: &armappcontainers.ManagedEnvironmentProperties{ - // AppLogsConfiguration: &armappcontainers.AppLogsConfiguration{ - // Destination: to.Ptr("log-analytics"), - // LogAnalyticsConfiguration: &armappcontainers.LogAnalyticsConfiguration{ - // CustomerID: to.Ptr("9ccccd4a-268f-4a9a-8d03-9bfe77c3fbd2"), - // DynamicJSONColumns: to.Ptr(true), - // }, - // }, - // 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:00.000Z"); 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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_ListByResourceGroup.json -func ExampleManagedEnvironmentsClient_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.NewManagedEnvironmentsClient().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.ManagedEnvironmentsCollection = armappcontainers.ManagedEnvironmentsCollection{ - // Value: []*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:00.000Z"); 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"), - // EnableFips: to.Ptr(true), - // 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), - // }, - // }, - // { - // Name: to.Ptr("demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/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-name2.com"), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-06T04:00:00.000Z"); 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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Get.json -func ExampleManagedEnvironmentsClient_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.NewManagedEnvironmentsClient().Get(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:00.000Z"); 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"), - // }, - // PeerAuthentication: &armappcontainers.ManagedEnvironmentPropertiesPeerAuthentication{ - // Mtls: &armappcontainers.Mtls{ - // Enabled: to.Ptr(true), - // }, - // }, - // PeerTrafficConfiguration: &armappcontainers.ManagedEnvironmentPropertiesPeerTrafficConfiguration{ - // Encryption: &armappcontainers.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption{ - // Enabled: to.Ptr(true), - // }, - // }, - // 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"), - // EnableFips: to.Ptr(true), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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"), - EnableFips: to.Ptr(true), - 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:00.000Z"); 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"), - // EnableFips: to.Ptr(true), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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) - } - 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"), - Identity: &armappcontainers.ManagedServiceIdentity{ - Type: to.Ptr(armappcontainers.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), - UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {}, - }, - }, - Properties: &armappcontainers.ManagedEnvironmentProperties{ - AppInsightsConfiguration: &armappcontainers.AppInsightsConfiguration{ - ConnectionString: to.Ptr("InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/"), - }, - AppLogsConfiguration: &armappcontainers.AppLogsConfiguration{ - LogAnalyticsConfiguration: &armappcontainers.LogAnalyticsConfiguration{ - CustomerID: to.Ptr("string"), - DynamicJSONColumns: to.Ptr(true), - 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/"), - OpenTelemetryConfiguration: &armappcontainers.OpenTelemetryConfiguration{ - DestinationsConfiguration: &armappcontainers.DestinationsConfiguration{ - DataDogConfiguration: &armappcontainers.DataDogConfiguration{ - Key: to.Ptr("000000000000000000000000"), - Site: to.Ptr("string"), - }, - OtlpConfigurations: []*armappcontainers.OtlpConfiguration{ - { - Name: to.Ptr("dashboard"), - Endpoint: to.Ptr("dashboard.k8s.region.azurecontainerapps.io:80"), - Headers: []*armappcontainers.Header{ - { - Key: to.Ptr("api-key"), - Value: to.Ptr("xxxxxxxxxxx"), - }}, - Insecure: to.Ptr(true), - }}, - }, - LogsConfiguration: &armappcontainers.LogsConfiguration{ - Destinations: []*string{ - to.Ptr("appInsights")}, - }, - MetricsConfiguration: &armappcontainers.MetricsConfiguration{ - Destinations: []*string{ - to.Ptr("dataDog")}, - IncludeKeda: to.Ptr(true), - }, - TracesConfiguration: &armappcontainers.TracesConfiguration{ - Destinations: []*string{ - to.Ptr("appInsights")}, - IncludeDapr: to.Ptr(true), - }, - }, - PeerAuthentication: &armappcontainers.ManagedEnvironmentPropertiesPeerAuthentication{ - Mtls: &armappcontainers.Mtls{ - Enabled: to.Ptr(true), - }, - }, - PeerTrafficConfiguration: &armappcontainers.ManagedEnvironmentPropertiesPeerTrafficConfiguration{ - Encryption: &armappcontainers.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption{ - Enabled: 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"), - EnableFips: to.Ptr(true), - 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"), - // Identity: &armappcontainers.ManagedServiceIdentity{ - // Type: to.Ptr(armappcontainers.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armappcontainers.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armappcontainers.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armappcontainers.ManagedEnvironmentProperties{ - // AppLogsConfiguration: &armappcontainers.AppLogsConfiguration{ - // LogAnalyticsConfiguration: &armappcontainers.LogAnalyticsConfiguration{ - // CustomerID: to.Ptr("string"), - // DynamicJSONColumns: to.Ptr(true), - // }, - // }, - // 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:00.000Z"); 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"), - // OpenTelemetryConfiguration: &armappcontainers.OpenTelemetryConfiguration{ - // DestinationsConfiguration: &armappcontainers.DestinationsConfiguration{ - // DataDogConfiguration: &armappcontainers.DataDogConfiguration{ - // Site: to.Ptr("datadoghq.com"), - // }, - // OtlpConfigurations: []*armappcontainers.OtlpConfiguration{ - // { - // Name: to.Ptr("dashboard"), - // Endpoint: to.Ptr("dashboard.k8s.region.azurecontainerapps.io:80"), - // Insecure: to.Ptr(true), - // }}, - // }, - // LogsConfiguration: &armappcontainers.LogsConfiguration{ - // Destinations: []*string{ - // to.Ptr("appInsights")}, - // }, - // MetricsConfiguration: &armappcontainers.MetricsConfiguration{ - // Destinations: []*string{ - // to.Ptr("dataDog")}, - // }, - // TracesConfiguration: &armappcontainers.TracesConfiguration{ - // Destinations: []*string{ - // to.Ptr("appInsights")}, - // }, - // }, - // PeerAuthentication: &armappcontainers.ManagedEnvironmentPropertiesPeerAuthentication{ - // Mtls: &armappcontainers.Mtls{ - // Enabled: to.Ptr(true), - // }, - // }, - // 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"), - // EnableFips: to.Ptr(true), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Delete.json -func ExampleManagedEnvironmentsClient_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.NewManagedEnvironmentsClient().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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Patch.json -func ExampleManagedEnvironmentsClient_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.NewManagedEnvironmentsClient().BeginUpdate(ctx, "examplerg", "testcontainerenv", armappcontainers.ManagedEnvironment{ - Location: to.Ptr("East US"), - 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) - } - 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:00.000Z"); 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"), - // EnableFips: to.Ptr(true), - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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.308Z"); return t}()), - // Token: to.Ptr("testToken"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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 index e93563d0e58d..f91dc26f7228 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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. @@ -47,7 +46,7 @@ func NewManagedEnvironmentsDiagnosticsClient(subscriptionID string, credential a // 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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -94,7 +93,7 @@ func (client *ManagedEnvironmentsDiagnosticsClient) getRootCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go deleted file mode 100644 index 0b5a0dcd3a0e..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go +++ /dev/null @@ -1,104 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-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:00.000Z"); 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"), - // }, - // PeerAuthentication: &armappcontainers.ManagedEnvironmentPropertiesPeerAuthentication{ - // Mtls: &armappcontainers.Mtls{ - // Enabled: to.Ptr(true), - // }, - // }, - // PeerTrafficConfiguration: &armappcontainers.ManagedEnvironmentPropertiesPeerTrafficConfiguration{ - // Encryption: &armappcontainers.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption{ - // Enabled: to.Ptr(true), - // }, - // }, - // 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"), - // EnableFips: to.Ptr(true), - // 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 0115419b12ee..9cf3ac579fb6 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ManagedEnvironmentsStoragesClient contains the methods for the ManagedEnvironmentsStorages group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -100,7 +99,7 @@ func (client *ManagedEnvironmentsStoragesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, storageEnvelope); err != nil { @@ -121,7 +120,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -172,7 +171,7 @@ func (client *ManagedEnvironmentsStoragesClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +180,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 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -233,7 +232,7 @@ func (client *ManagedEnvironmentsStoragesClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +250,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 2024-08-02-preview +// Generated from API version 2024-10-02-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 @@ -298,7 +297,7 @@ func (client *ManagedEnvironmentsStoragesClient) listCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-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 deleted file mode 100644 index 063691e7291d..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client_example_test.go +++ /dev/null @@ -1,228 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_List.json -func ExampleManagedEnvironmentsStoragesClient_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.NewManagedEnvironmentsStoragesClient().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.ManagedEnvironmentStoragesCollection = armappcontainers.ManagedEnvironmentStoragesCollection{ - // Value: []*armappcontainers.ManagedEnvironmentStorage{ - // { - // Name: to.Ptr("jlaw-demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/storages"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/storages/jlaw-demo1"), - // Properties: &armappcontainers.ManagedEnvironmentStorageProperties{ - // AzureFile: &armappcontainers.AzureFileProperties{ - // AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), - // AccountName: to.Ptr("account1"), - // ShareName: to.Ptr("share1"), - // }, - // }, - // }, - // { - // Name: to.Ptr("jlaw-demo2"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/storages"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/storages/jlaw-demo2"), - // Properties: &armappcontainers.ManagedEnvironmentStorageProperties{ - // NfsAzureFile: &armappcontainers.NfsAzureFileProperties{ - // AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), - // Server: to.Ptr("server1"), - // ShareName: to.Ptr("share1"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Get.json -func ExampleManagedEnvironmentsStoragesClient_Get_getAEnvironmentsStorage() { - 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.NewManagedEnvironmentsStoragesClient().Get(ctx, "examplerg", "managedEnv", "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.ManagedEnvironmentStorage = armappcontainers.ManagedEnvironmentStorage{ - // Name: to.Ptr("jlaw-demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/storages"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/storages/jlaw-demo1"), - // Properties: &armappcontainers.ManagedEnvironmentStorageProperties{ - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json -func ExampleManagedEnvironmentsStoragesClient_Get_getAEnvironmentsStorageForNfsAzureFile() { - 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.NewManagedEnvironmentsStoragesClient().Get(ctx, "examplerg", "managedEnv", "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.ManagedEnvironmentStorage = armappcontainers.ManagedEnvironmentStorage{ - // Name: to.Ptr("jlaw-demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/storages"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/storages/jlaw-demo1"), - // Properties: &armappcontainers.ManagedEnvironmentStorageProperties{ - // NfsAzureFile: &armappcontainers.NfsAzureFileProperties{ - // AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), - // Server: to.Ptr("server1"), - // ShareName: to.Ptr("share1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json -func ExampleManagedEnvironmentsStoragesClient_CreateOrUpdate_createOrUpdateEnvironmentsStorage() { - 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.NewManagedEnvironmentsStoragesClient().CreateOrUpdate(ctx, "examplerg", "managedEnv", "jlaw-demo1", armappcontainers.ManagedEnvironmentStorage{ - Properties: &armappcontainers.ManagedEnvironmentStorageProperties{ - 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.ManagedEnvironmentStorage = armappcontainers.ManagedEnvironmentStorage{ - // Name: to.Ptr("jlaw-demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/storages"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/storages/jlaw-demo1"), - // Properties: &armappcontainers.ManagedEnvironmentStorageProperties{ - // 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/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json -func ExampleManagedEnvironmentsStoragesClient_CreateOrUpdate_createOrUpdateEnvironmentsStorageForNfsAzureFile() { - 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.NewManagedEnvironmentsStoragesClient().CreateOrUpdate(ctx, "examplerg", "managedEnv", "jlaw-demo1", armappcontainers.ManagedEnvironmentStorage{ - Properties: &armappcontainers.ManagedEnvironmentStorageProperties{ - NfsAzureFile: &armappcontainers.NfsAzureFileProperties{ - AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), - Server: to.Ptr("server1"), - 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.ManagedEnvironmentStorage = armappcontainers.ManagedEnvironmentStorage{ - // Name: to.Ptr("jlaw-demo1"), - // Type: to.Ptr("Microsoft.App/managedEnvironments/storages"), - // ID: to.Ptr("/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/managedEnv/storages/jlaw-demo1"), - // Properties: &armappcontainers.ManagedEnvironmentStorageProperties{ - // NfsAzureFile: &armappcontainers.NfsAzureFileProperties{ - // AccessMode: to.Ptr(armappcontainers.AccessModeReadOnly), - // Server: to.Ptr("server1"), - // ShareName: to.Ptr("share1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Delete.json -func ExampleManagedEnvironmentsStoragesClient_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.NewManagedEnvironmentsStoragesClient().Delete(ctx, "examplerg", "managedEnv", "jlaw-demo1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client.go index 9f7b5b3a1f94..2a5f4200ecb9 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // ManagedEnvironmentUsagesClient contains the methods for the ManagedEnvironmentUsages group. @@ -46,7 +45,7 @@ func NewManagedEnvironmentUsagesClient(subscriptionID string, credential azcore. // NewListPager - Gets the current usage information as well as the limits for environment. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - options - ManagedEnvironmentUsagesClientListOptions contains the optional parameters for the ManagedEnvironmentUsagesClient.NewListPager @@ -94,7 +93,7 @@ func (client *ManagedEnvironmentUsagesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client_example_test.go deleted file mode 100644 index 731f8e4d5274..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client_example_test.go +++ /dev/null @@ -1,55 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentUsages_List.json -func ExampleManagedEnvironmentUsagesClient_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.NewManagedEnvironmentUsagesClient().NewListPager("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.ListUsagesResult = armappcontainers.ListUsagesResult{ - // Value: []*armappcontainers.Usage{ - // { - // Name: &armappcontainers.UsageName{ - // LocalizedValue: to.Ptr("Managed Environment Consumption Cores"), - // Value: to.Ptr("ManagedEnvironmentConsumptionCores"), - // }, - // CurrentValue: to.Ptr[float32](0.5), - // Limit: to.Ptr[float32](10), - // Unit: to.Ptr("Count"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/models.go b/sdk/resourcemanager/appcontainers/armappcontainers/models.go index fd954fb505fc..795be464e0e7 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/models.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/models.go @@ -429,7 +429,17 @@ type BillingMeterProperties struct { // BlobStorageTokenStore - The configuration settings of the storage of the tokens if blob storage is used. type BlobStorageTokenStore struct { - // REQUIRED; The name of the app secrets containing the SAS URL of the blob storage containing the tokens. + // The URI of the blob storage containing the tokens. Should not be used along with sasUrlSettingName. + BlobContainerURI *string + + // The Client ID of a User-Assigned Managed Identity. Should not be used along with managedIdentityResourceId. + ClientID *string + + // The Resource ID of a User-Assigned Managed Identity. Should not be used along with clientId. + ManagedIdentityResourceID *string + + // The name of the app secrets containing the SAS URL of the blob storage containing the tokens. Should not be used along + // with blobContainerUri. SasURLSettingName *string } @@ -639,6 +649,9 @@ type CertificateProperties struct { // PFX or PEM blob Value []byte + // READ-ONLY; Any errors that occurred during deployment or deployment validation + DeploymentErrors *string + // READ-ONLY; Certificate expiration date. ExpirationDate *time.Time @@ -712,9 +725,10 @@ type ClientRegistration struct { // Configuration - Non versioned Container App configuration properties that define the mutable settings of a Container app type Configuration struct { - // ActiveRevisionsMode controls how active revisions are handled for the Container app:Multiple: multiple revisions can be - // active.Single: Only one revision can be active at a time. Revision weights can - // not be used in this mode. If no value if provided, this is the default. + // ActiveRevisionsMode controls how active revisions are handled for the Container app:Single: Only one revision can be active + // at a time. Traffic weights cannot be used. This is the default.Multiple: + // Multiple revisions can be active, including optional traffic weights and labels.Labels: Only revisions with labels are + // active. Traffic weights can be applied to labels. ActiveRevisionsMode *ActiveRevisionsMode // Dapr configuration for the Container App. @@ -733,6 +747,11 @@ type Configuration struct { // Collection of private container registry credentials for containers used by the Container app Registries []*RegistryCredentials + // Optional. The percent of the total number of replicas that must be brought up before revision transition occurs. Defaults + // to 100 when none is given. Value must be greater than 0 and less than or equal + // to 100. + RevisionTransitionThreshold *int32 + // App runtime configuration for the Container App. Runtime *Runtime @@ -741,6 +760,9 @@ type Configuration struct { // Container App to be a dev Container App Service Service *Service + + // Required in labels revisions mode. Label to apply to newly created revision. + TargetLabel *string } // ConnectedEnvironment - An environment for Kubernetes cluster specialized for web workloads by Azure App Service @@ -779,6 +801,69 @@ type ConnectedEnvironmentCollection struct { NextLink *string } +// ConnectedEnvironmentDaprComponent - Dapr Component. +type ConnectedEnvironmentDaprComponent struct { + // Dapr component properties + Properties *ConnectedEnvironmentDaprComponentProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// ConnectedEnvironmentDaprComponentProperties - Dapr component properties +type ConnectedEnvironmentDaprComponentProperties struct { + // Component type + ComponentType *string + + // Boolean describing if the component errors are ignores + IgnoreErrors *bool + + // Initialization timeout + InitTimeout *string + + // Component metadata + Metadata []*DaprMetadata + + // Names of container apps that can use this Dapr component + Scopes []*string + + // Name of a Dapr component to retrieve component secrets from + SecretStoreComponent *string + + // Collection of secrets used by a Dapr component + Secrets []*Secret + + // List of container app services that are bound to the Dapr component + ServiceComponentBind []*DaprComponentServiceBinding + + // Component version + Version *string + + // READ-ONLY; Any errors that occurred during deployment or deployment validation + DeploymentErrors *string + + // READ-ONLY; Provisioning state of the Connected Environment Dapr Component. + ProvisioningState *ConnectedEnvironmentDaprComponentProvisioningState +} + +// ConnectedEnvironmentDaprComponentsCollection - Collection of Dapr Components for Environments +type ConnectedEnvironmentDaprComponentsCollection struct { + // REQUIRED; Collection of Dapr component resources. + Value []*ConnectedEnvironmentDaprComponent + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + // ConnectedEnvironmentProperties - ConnectedEnvironment resource specific properties type ConnectedEnvironmentProperties struct { // Custom domain configuration for the environment @@ -825,6 +910,12 @@ type ConnectedEnvironmentStorageProperties struct { // SMB storage properties Smb *SmbStorage + + // READ-ONLY; Any errors that occurred during deployment or deployment validation + DeploymentErrors *string + + // READ-ONLY; Provisioning state of the storage. + ProvisioningState *ConnectedEnvironmentStorageProvisioningState } // ConnectedEnvironmentStoragesCollection - Collection of Storage for Environments @@ -1078,6 +1169,9 @@ type ContainerAppProperties struct { // READ-ONLY; Provisioning state of the Container App. ProvisioningState *ContainerAppProvisioningState + + // READ-ONLY; Running status of the Container App. + RunningStatus *ContainerAppRunningStatus } // ContainerAppPropertiesPatchingConfiguration - Container App auto patch configuration. @@ -1223,6 +1317,9 @@ type ContainerResources struct { // Required CPU in cores, e.g. 0.5 CPU *float64 + // Required GPU in cores for GPU based app, e.g. 1.0 + Gpu *float64 + // Required memory, e.g. "250Mb" Memory *string @@ -2300,6 +2397,117 @@ type HTTPRetryPolicyRetryBackOff struct { MaxIntervalInMilliseconds *int64 } +// HTTPRoute - Http Routes configuration, including paths to match on and whether or not rewrites are to be done. +type HTTPRoute struct { + // Once route is matched, what is the desired action + Action *HTTPRouteAction + + // Conditions route will match on + Match *HTTPRouteMatch +} + +// HTTPRouteAction - Action to perform once matching of routes is done +type HTTPRouteAction struct { + // Rewrite prefix, default is no rewrites + PrefixRewrite *string +} + +// HTTPRouteConfig - Advanced Ingress routing for path/header based routing for a Container App Environment +type HTTPRouteConfig struct { + // Http Route Config properties + Properties *HTTPRouteConfigProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// HTTPRouteConfigCollection - Collection of Advanced Ingress Routing Config resources. +type HTTPRouteConfigCollection struct { + // REQUIRED; Collection of resources. + Value []*HTTPRouteConfig + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// HTTPRouteConfigProperties - Http Route Config properties +type HTTPRouteConfigProperties struct { + // Custom domain bindings for http Routes' hostnames. + CustomDomains []*CustomDomain + + // Routing Rules for http route resource. + Rules []*HTTPRouteRule + + // READ-ONLY; FQDN of the route resource. + Fqdn *string + + // READ-ONLY; List of errors when trying to reconcile http routes + ProvisioningErrors []*HTTPRouteProvisioningErrors + + // READ-ONLY; The provisioning state of the Http Route Config in cluster + ProvisioningState *HTTPRouteProvisioningState +} + +// HTTPRouteMatch - Criteria to match on +type HTTPRouteMatch struct { + // path case sensitive, default is true + CaseSensitive *bool + + // match on exact path + Path *string + + // match on all prefix's. Not exact + PathSeparatedPrefix *string + + // match on all prefix's. Not exact + Prefix *string +} + +// HTTPRouteProvisioningErrors - List of provisioning errors for a http route config object +type HTTPRouteProvisioningErrors struct { + // READ-ONLY; Description or error message + Message *string + + // READ-ONLY; Timestamp error occured at + Timestamp *time.Time +} + +// HTTPRouteRule - Http Route rule. +type HTTPRouteRule struct { + // Description of rule. Optional. + Description *string + + // Routing configuration that will allow matches on specific paths/headers. + Routes []*HTTPRoute + + // Targets- container apps, revisions, labels + Targets []*HTTPRouteTarget +} + +// HTTPRouteTarget - Targets - Container App Names, Revision Names, Labels. +type HTTPRouteTarget struct { + // REQUIRED; Container App Name to route requests to + ContainerApp *string + + // Label/Revision to route requests to + Label *string + + // Revision to route requests to + Revision *string + + // Weighted routing + Weight *int32 +} + // HTTPScaleRule - Container App container Http scaling rule. type HTTPScaleRule struct { // Authentication secrets for the custom scale rule. @@ -2905,6 +3113,52 @@ type KedaConfiguration struct { Version *string } +// LabelHistory - Container App Label History. +type LabelHistory struct { + // Container App Label History resource specific properties + Properties *LabelHistoryProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// LabelHistoryCollection - Container App Label History collection ARM resource. +type LabelHistoryCollection struct { + // REQUIRED; Collection of resources. + Value []*LabelHistory + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// LabelHistoryProperties - Container App Label History resource specific properties +type LabelHistoryProperties struct { + // READ-ONLY; List of label history records. + Records []*LabelHistoryRecordItem +} + +// LabelHistoryRecordItem - Container App Label History Item resource specific properties +type LabelHistoryRecordItem struct { + // READ-ONLY; Container App revision name that label was applied to. + Revision *string + + // READ-ONLY; Timestamp describing when the label was applied to the revision. + Start *time.Time + + // READ-ONLY; Timestamp describing when the label was removed from the revision. Only meaningful when the label is currently + // applied to the revision. + Stop *time.Time +} + type ListUsagesResult struct { // The URI to fetch the next page of compute resource usage information. Call ListNext() with this to fetch the next page // of compute resource usage information. @@ -2994,6 +3248,33 @@ type LogsConfiguration struct { Destinations []*string } +// MaintenanceConfigurationCollection - The response of list maintenance configuration resources. +type MaintenanceConfigurationCollection struct { + // Results of the list maintenance configuration resources. + Value []*MaintenanceConfigurationResource + + // READ-ONLY; Link for next page of results. + NextLink *string +} + +// MaintenanceConfigurationResource - Information about the Maintenance Configuration resource. +type MaintenanceConfigurationResource struct { + // The resource-specific properties for this resource. + Properties *ScheduledEntries + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + // 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 @@ -3087,10 +3368,12 @@ type ManagedEnvironmentProperties struct { // Environment level Application Insights configuration AppInsightsConfiguration *AppInsightsConfiguration - // Cluster configuration which enables the log daemon to export app logs to a destination. Currently only "log-analytics" - // is supported + // Cluster configuration which enables the log daemon to export app logs to configured destination AppLogsConfiguration *AppLogsConfiguration + // The list of availability zones to use for managed environment + AvailabilityZones []*string + // Custom domain configuration for the environment CustomDomainConfiguration *CustomDomainConfiguration @@ -3144,6 +3427,9 @@ type ManagedEnvironmentProperties struct { // READ-ONLY; Private endpoint connections to the resource. PrivateEndpointConnections []*PrivateEndpointConnection + // READ-ONLY; Private Link Default Domain Name for the environment + PrivateLinkDefaultDomain *string + // READ-ONLY; Provisioning state of the Environment. ProvisioningState *EnvironmentProvisioningState @@ -3211,6 +3497,16 @@ type ManagedEnvironmentsCollection struct { NextLink *string } +// ManagedIdentitySetting - Optional settings for a Managed Identity that is assigned to the Session pool. +type ManagedIdentitySetting struct { + // REQUIRED; The resource ID of a user-assigned managed identity that is assigned to the Session Pool, or 'system' for system-assigned + // identity. + Identity *string + + // Use to select the lifecycle stages of a Session Pool during which the Managed Identity should be available. + Lifecycle *IdentitySettingsLifeCycle +} + // 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). @@ -3812,6 +4108,9 @@ type RevisionProperties struct { // READ-ONLY; Current health State of the revision HealthState *RevisionHealthState + // READ-ONLY; List of labels assigned to this revision. + Labels []*string + // READ-ONLY; Timestamp describing when the revision was last active. Only meaningful when revision is inactive LastActiveTime *time.Time @@ -3946,6 +4245,24 @@ type ScgRoute struct { Predicates []*string } +// ScheduledEntries - List of maintenance schedules for a managed environment. +type ScheduledEntries struct { + // REQUIRED; List of maintenance schedules for a managed environment. + ScheduledEntries []*ScheduledEntry +} + +// ScheduledEntry - Maintenance schedule entry for a managed environment. +type ScheduledEntry struct { + // REQUIRED; Length of maintenance window range from 8 to 24 hours. + DurationHours *int32 + + // REQUIRED; Start hour after which managed environment maintenance can start from 0 to 23 hour. + StartHourUTC *int32 + + // REQUIRED; Day of the week when a managed environment can be patched. + WeekDay *WeekDay +} + // 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. @@ -4044,6 +4361,10 @@ type SessionPool struct { // REQUIRED; The geo-location where the resource lives Location *string + // Managed identities needed by a session pool to interact with other Azure services to not maintain any secrets or credentials + // in code. + Identity *ManagedServiceIdentity + // Container App session pool resource specific properties Properties *SessionPoolProperties @@ -4086,6 +4407,9 @@ type SessionPoolProperties struct { // Resource ID of the session pool's environment. EnvironmentID *string + // Optional settings for a Managed Identity that is assigned to the Session pool. + ManagedIdentitySettings []*ManagedIdentitySetting + // The pool management type of the session pool. PoolManagementType *PoolManagementType @@ -4119,6 +4443,10 @@ type SessionPoolSecret struct { // SessionPoolUpdatableProperties - Container App session pool updatable properties. type SessionPoolUpdatableProperties struct { + // Managed identities needed by a session pool to interact with other Azure services to not maintain any secrets or credentials + // in code. + Identity *ManagedServiceIdentity + // Session pool resource specific updatable properties. Properties *SessionPoolUpdatablePropertiesProperties } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go b/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go index 18fc9972a2b5..4de82f651f6e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go @@ -11,10 +11,9 @@ package armappcontainers import ( "encoding/json" "fmt" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" ) // MarshalJSON implements the json.Marshaller interface for type AllowedAudiencesValidation. @@ -1122,6 +1121,9 @@ func (b *BillingMeterProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BlobStorageTokenStore. func (b BlobStorageTokenStore) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "blobContainerUri", b.BlobContainerURI) + populate(objectMap, "clientId", b.ClientID) + populate(objectMap, "managedIdentityResourceId", b.ManagedIdentityResourceID) populate(objectMap, "sasUrlSettingName", b.SasURLSettingName) return json.Marshal(objectMap) } @@ -1135,6 +1137,15 @@ func (b *BlobStorageTokenStore) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "blobContainerUri": + err = unpopulate(val, "BlobContainerURI", &b.BlobContainerURI) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &b.ClientID) + delete(rawMsg, key) + case "managedIdentityResourceId": + err = unpopulate(val, "ManagedIdentityResourceID", &b.ManagedIdentityResourceID) + delete(rawMsg, key) case "sasUrlSettingName": err = unpopulate(val, "SasURLSettingName", &b.SasURLSettingName) delete(rawMsg, key) @@ -1673,6 +1684,7 @@ func (c CertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "certificateKeyVaultProperties", c.CertificateKeyVaultProperties) populate(objectMap, "certificateType", c.CertificateType) + populate(objectMap, "deploymentErrors", c.DeploymentErrors) populateDateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) populateDateTimeRFC3339(objectMap, "issueDate", c.IssueDate) populate(objectMap, "issuer", c.Issuer) @@ -1704,6 +1716,9 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { case "certificateType": err = unpopulate(val, "CertificateType", &c.CertificateType) delete(rawMsg, key) + case "deploymentErrors": + err = unpopulate(val, "DeploymentErrors", &c.DeploymentErrors) + delete(rawMsg, key) case "expirationDate": err = unpopulateDateTimeRFC3339(val, "ExpirationDate", &c.ExpirationDate) delete(rawMsg, key) @@ -1888,9 +1903,11 @@ func (c Configuration) MarshalJSON() ([]byte, error) { populate(objectMap, "ingress", c.Ingress) populate(objectMap, "maxInactiveRevisions", c.MaxInactiveRevisions) populate(objectMap, "registries", c.Registries) + populate(objectMap, "revisionTransitionThreshold", c.RevisionTransitionThreshold) populate(objectMap, "runtime", c.Runtime) populate(objectMap, "secrets", c.Secrets) populate(objectMap, "service", c.Service) + populate(objectMap, "targetLabel", c.TargetLabel) return json.Marshal(objectMap) } @@ -1921,6 +1938,9 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { case "registries": err = unpopulate(val, "Registries", &c.Registries) delete(rawMsg, key) + case "revisionTransitionThreshold": + err = unpopulate(val, "RevisionTransitionThreshold", &c.RevisionTransitionThreshold) + delete(rawMsg, key) case "runtime": err = unpopulate(val, "Runtime", &c.Runtime) delete(rawMsg, key) @@ -1930,6 +1950,9 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { case "service": err = unpopulate(val, "Service", &c.Service) delete(rawMsg, key) + case "targetLabel": + err = unpopulate(val, "TargetLabel", &c.TargetLabel) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2024,6 +2047,147 @@ func (c *ConnectedEnvironmentCollection) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentDaprComponent. +func (c ConnectedEnvironmentDaprComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentDaprComponent. +func (c *ConnectedEnvironmentDaprComponent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentDaprComponentProperties. +func (c ConnectedEnvironmentDaprComponentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "componentType", c.ComponentType) + populate(objectMap, "deploymentErrors", c.DeploymentErrors) + populate(objectMap, "ignoreErrors", c.IgnoreErrors) + populate(objectMap, "initTimeout", c.InitTimeout) + populate(objectMap, "metadata", c.Metadata) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "scopes", c.Scopes) + populate(objectMap, "secretStoreComponent", c.SecretStoreComponent) + populate(objectMap, "secrets", c.Secrets) + populate(objectMap, "serviceComponentBind", c.ServiceComponentBind) + populate(objectMap, "version", c.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentDaprComponentProperties. +func (c *ConnectedEnvironmentDaprComponentProperties) UnmarshalJSON(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 "componentType": + err = unpopulate(val, "ComponentType", &c.ComponentType) + delete(rawMsg, key) + case "deploymentErrors": + err = unpopulate(val, "DeploymentErrors", &c.DeploymentErrors) + delete(rawMsg, key) + case "ignoreErrors": + err = unpopulate(val, "IgnoreErrors", &c.IgnoreErrors) + delete(rawMsg, key) + case "initTimeout": + err = unpopulate(val, "InitTimeout", &c.InitTimeout) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &c.Metadata) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &c.Scopes) + delete(rawMsg, key) + case "secretStoreComponent": + err = unpopulate(val, "SecretStoreComponent", &c.SecretStoreComponent) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &c.Secrets) + delete(rawMsg, key) + case "serviceComponentBind": + err = unpopulate(val, "ServiceComponentBind", &c.ServiceComponentBind) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &c.Version) + 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 ConnectedEnvironmentDaprComponentsCollection. +func (c ConnectedEnvironmentDaprComponentsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEnvironmentDaprComponentsCollection. +func (c *ConnectedEnvironmentDaprComponentsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ConnectedEnvironmentProperties. func (c ConnectedEnvironmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2118,6 +2282,8 @@ func (c *ConnectedEnvironmentStorage) UnmarshalJSON(data []byte) error { func (c ConnectedEnvironmentStorageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "azureFile", c.AzureFile) + populate(objectMap, "deploymentErrors", c.DeploymentErrors) + populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "smb", c.Smb) return json.Marshal(objectMap) } @@ -2134,6 +2300,12 @@ func (c *ConnectedEnvironmentStorageProperties) UnmarshalJSON(data []byte) error case "azureFile": err = unpopulate(val, "AzureFile", &c.AzureFile) 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 "smb": err = unpopulate(val, "Smb", &c.Smb) delete(rawMsg, key) @@ -2621,6 +2793,7 @@ func (c ContainerAppProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "outboundIpAddresses", c.OutboundIPAddresses) populate(objectMap, "patchingConfiguration", c.PatchingConfiguration) populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "runningStatus", c.RunningStatus) populate(objectMap, "template", c.Template) populate(objectMap, "workloadProfileName", c.WorkloadProfileName) return json.Marshal(objectMap) @@ -2671,6 +2844,9 @@ func (c *ContainerAppProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) + case "runningStatus": + err = unpopulate(val, "RunningStatus", &c.RunningStatus) + delete(rawMsg, key) case "template": err = unpopulate(val, "Template", &c.Template) delete(rawMsg, key) @@ -3060,6 +3236,7 @@ func (c ContainerResources) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "cpu", c.CPU) populate(objectMap, "ephemeralStorage", c.EphemeralStorage) + populate(objectMap, "gpu", c.Gpu) populate(objectMap, "memory", c.Memory) return json.Marshal(objectMap) } @@ -3079,6 +3256,9 @@ func (c *ContainerResources) UnmarshalJSON(data []byte) error { case "ephemeralStorage": err = unpopulate(val, "EphemeralStorage", &c.EphemeralStorage) delete(rawMsg, key) + case "gpu": + err = unpopulate(val, "Gpu", &c.Gpu) + delete(rawMsg, key) case "memory": err = unpopulate(val, "Memory", &c.Memory) delete(rawMsg, key) @@ -6026,17 +6206,16 @@ func (h *HTTPRetryPolicyRetryBackOff) UnmarshalJSON(data []byte) error { 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 HTTPRoute. +func (h HTTPRoute) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "auth", h.Auth) - populate(objectMap, "identity", h.Identity) - populate(objectMap, "metadata", h.Metadata) + populate(objectMap, "action", h.Action) + populate(objectMap, "match", h.Match) 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 HTTPRoute. +func (h *HTTPRoute) UnmarshalJSON(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) @@ -6044,14 +6223,11 @@ func (h *HTTPScaleRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "auth": - err = unpopulate(val, "Auth", &h.Auth) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &h.Identity) + case "action": + err = unpopulate(val, "Action", &h.Action) delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &h.Metadata) + case "match": + err = unpopulate(val, "Match", &h.Match) delete(rawMsg, key) } if err != nil { @@ -6061,17 +6237,15 @@ func (h *HTTPScaleRule) UnmarshalJSON(data []byte) error { 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 HTTPRouteAction. +func (h HTTPRouteAction) 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, "prefixRewrite", h.PrefixRewrite) 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 HTTPRouteAction. +func (h *HTTPRouteAction) UnmarshalJSON(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) @@ -6079,14 +6253,8 @@ func (h *HTTPSettings) UnmarshalJSON(data []byte) error { 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 "prefixRewrite": + err = unpopulate(val, "PrefixRewrite", &h.PrefixRewrite) delete(rawMsg, key) } if err != nil { @@ -6096,15 +6264,19 @@ func (h *HTTPSettings) UnmarshalJSON(data []byte) error { 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 HTTPRouteConfig. +func (h HTTPRouteConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiPrefix", h.APIPrefix) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) 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 HTTPRouteConfig. +func (h *HTTPRouteConfig) UnmarshalJSON(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) @@ -6112,8 +6284,20 @@ func (h *HTTPSettingsRoutes) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "apiPrefix": - err = unpopulate(val, "APIPrefix", &h.APIPrefix) + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) delete(rawMsg, key) } if err != nil { @@ -6123,16 +6307,16 @@ func (h *HTTPSettingsRoutes) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Header. -func (h Header) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HTTPRouteConfigCollection. +func (h HTTPRouteConfigCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", h.Key) + populate(objectMap, "nextLink", h.NextLink) populate(objectMap, "value", h.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Header. -func (h *Header) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRouteConfigCollection. +func (h *HTTPRouteConfigCollection) UnmarshalJSON(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) @@ -6140,8 +6324,8 @@ func (h *Header) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &h.Key) + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &h.Value) @@ -6154,16 +6338,19 @@ func (h *Header) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type HeaderMatch. -func (h HeaderMatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HTTPRouteConfigProperties. +func (h HTTPRouteConfigProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "header", h.Header) - populate(objectMap, "match", h.Match) + populate(objectMap, "customDomains", h.CustomDomains) + populate(objectMap, "fqdn", h.Fqdn) + populate(objectMap, "provisioningErrors", h.ProvisioningErrors) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "rules", h.Rules) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HeaderMatch. -func (h *HeaderMatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRouteConfigProperties. +func (h *HTTPRouteConfigProperties) UnmarshalJSON(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) @@ -6171,11 +6358,20 @@ func (h *HeaderMatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "header": - err = unpopulate(val, "Header", &h.Header) + case "customDomains": + err = unpopulate(val, "CustomDomains", &h.CustomDomains) delete(rawMsg, key) - case "match": - err = unpopulate(val, "Match", &h.Match) + case "fqdn": + err = unpopulate(val, "Fqdn", &h.Fqdn) + delete(rawMsg, key) + case "provisioningErrors": + err = unpopulate(val, "ProvisioningErrors", &h.ProvisioningErrors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &h.Rules) delete(rawMsg, key) } if err != nil { @@ -6185,18 +6381,18 @@ func (h *HeaderMatch) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type HeaderMatchMatch. -func (h HeaderMatchMatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HTTPRouteMatch. +func (h HTTPRouteMatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "exactMatch", h.ExactMatch) - populate(objectMap, "prefixMatch", h.PrefixMatch) - populate(objectMap, "regexMatch", h.RegexMatch) - populate(objectMap, "suffixMatch", h.SuffixMatch) + populate(objectMap, "caseSensitive", h.CaseSensitive) + populate(objectMap, "path", h.Path) + populate(objectMap, "pathSeparatedPrefix", h.PathSeparatedPrefix) + populate(objectMap, "prefix", h.Prefix) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HeaderMatchMatch. -func (h *HeaderMatchMatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRouteMatch. +func (h *HTTPRouteMatch) UnmarshalJSON(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) @@ -6204,17 +6400,17 @@ func (h *HeaderMatchMatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "exactMatch": - err = unpopulate(val, "ExactMatch", &h.ExactMatch) + case "caseSensitive": + err = unpopulate(val, "CaseSensitive", &h.CaseSensitive) delete(rawMsg, key) - case "prefixMatch": - err = unpopulate(val, "PrefixMatch", &h.PrefixMatch) + case "path": + err = unpopulate(val, "Path", &h.Path) delete(rawMsg, key) - case "regexMatch": - err = unpopulate(val, "RegexMatch", &h.RegexMatch) + case "pathSeparatedPrefix": + err = unpopulate(val, "PathSeparatedPrefix", &h.PathSeparatedPrefix) delete(rawMsg, key) - case "suffixMatch": - err = unpopulate(val, "SuffixMatch", &h.SuffixMatch) + case "prefix": + err = unpopulate(val, "Prefix", &h.Prefix) delete(rawMsg, key) } if err != nil { @@ -6224,50 +6420,353 @@ func (h *HeaderMatchMatch) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type IPSecurityRestrictionRule. -func (i IPSecurityRestrictionRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HTTPRouteProvisioningErrors. +func (h HTTPRouteProvisioningErrors) 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) + populate(objectMap, "message", h.Message) + populateDateTimeRFC3339(objectMap, "timestamp", h.Timestamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPSecurityRestrictionRule. -func (i *IPSecurityRestrictionRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRouteProvisioningErrors. +func (h *HTTPRouteProvisioningErrors) UnmarshalJSON(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", h, 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) + case "message": + err = unpopulate(val, "Message", &h.Message) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &h.Timestamp) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", h, 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 HTTPRouteRule. +func (h HTTPRouteRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apple", i.Apple) - populate(objectMap, "azureActiveDirectory", i.AzureActiveDirectory) + populate(objectMap, "description", h.Description) + populate(objectMap, "routes", h.Routes) + populate(objectMap, "targets", h.Targets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRouteRule. +func (h *HTTPRouteRule) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &h.Description) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &h.Routes) + delete(rawMsg, key) + case "targets": + err = unpopulate(val, "Targets", &h.Targets) + 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 HTTPRouteTarget. +func (h HTTPRouteTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "containerApp", h.ContainerApp) + populate(objectMap, "label", h.Label) + populate(objectMap, "revision", h.Revision) + populate(objectMap, "weight", h.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRouteTarget. +func (h *HTTPRouteTarget) UnmarshalJSON(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 "containerApp": + err = unpopulate(val, "ContainerApp", &h.ContainerApp) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &h.Label) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &h.Revision) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &h.Weight) + 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 HTTPScaleRule. +func (h HTTPScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "auth", h.Auth) + populate(objectMap, "identity", h.Identity) + 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 "identity": + err = unpopulate(val, "Identity", &h.Identity) + 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 HTTPSettingsRoutes. +func (h *HTTPSettingsRoutes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiPrefix": + err = unpopulate(val, "APIPrefix", &h.APIPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Header. +func (h Header) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", h.Key) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Header. +func (h *Header) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &h.Key) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + 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 HeaderMatch. +func (h HeaderMatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "header", h.Header) + populate(objectMap, "match", h.Match) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HeaderMatch. +func (h *HeaderMatch) UnmarshalJSON(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 "header": + err = unpopulate(val, "Header", &h.Header) + delete(rawMsg, key) + case "match": + err = unpopulate(val, "Match", &h.Match) + 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 HeaderMatchMatch. +func (h HeaderMatchMatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exactMatch", h.ExactMatch) + populate(objectMap, "prefixMatch", h.PrefixMatch) + populate(objectMap, "regexMatch", h.RegexMatch) + populate(objectMap, "suffixMatch", h.SuffixMatch) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HeaderMatchMatch. +func (h *HeaderMatchMatch) UnmarshalJSON(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 "exactMatch": + err = unpopulate(val, "ExactMatch", &h.ExactMatch) + delete(rawMsg, key) + case "prefixMatch": + err = unpopulate(val, "PrefixMatch", &h.PrefixMatch) + delete(rawMsg, key) + case "regexMatch": + err = unpopulate(val, "RegexMatch", &h.RegexMatch) + delete(rawMsg, key) + case "suffixMatch": + err = unpopulate(val, "SuffixMatch", &h.SuffixMatch) + 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", &i.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IdentityProviders. +func (i IdentityProviders) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]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) @@ -7589,6 +8088,142 @@ func (k *KedaConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LabelHistory. +func (l LabelHistory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LabelHistory. +func (l *LabelHistory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LabelHistoryCollection. +func (l LabelHistoryCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LabelHistoryCollection. +func (l *LabelHistoryCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LabelHistoryProperties. +func (l LabelHistoryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "records", l.Records) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LabelHistoryProperties. +func (l *LabelHistoryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "records": + err = unpopulate(val, "Records", &l.Records) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LabelHistoryRecordItem. +func (l LabelHistoryRecordItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "revision", l.Revision) + populateDateTimeRFC3339(objectMap, "start", l.Start) + populateDateTimeRFC3339(objectMap, "stop", l.Stop) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LabelHistoryRecordItem. +func (l *LabelHistoryRecordItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "revision": + err = unpopulate(val, "Revision", &l.Revision) + delete(rawMsg, key) + case "start": + err = unpopulateDateTimeRFC3339(val, "Start", &l.Start) + delete(rawMsg, key) + case "stop": + err = unpopulateDateTimeRFC3339(val, "Stop", &l.Stop) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ListUsagesResult. func (l ListUsagesResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7857,6 +8492,80 @@ func (l *LogsConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MaintenanceConfigurationCollection. +func (m MaintenanceConfigurationCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfigurationCollection. +func (m *MaintenanceConfigurationCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MaintenanceConfigurationResource. +func (m MaintenanceConfigurationResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfigurationResource. +func (m *MaintenanceConfigurationResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedCertificate. func (m ManagedCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8073,6 +8782,7 @@ func (m ManagedEnvironmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "appInsightsConfiguration", m.AppInsightsConfiguration) populate(objectMap, "appLogsConfiguration", m.AppLogsConfiguration) + populate(objectMap, "availabilityZones", m.AvailabilityZones) populate(objectMap, "customDomainConfiguration", m.CustomDomainConfiguration) populate(objectMap, "daprAIConnectionString", m.DaprAIConnectionString) populate(objectMap, "daprAIInstrumentationKey", m.DaprAIInstrumentationKey) @@ -8086,6 +8796,7 @@ func (m ManagedEnvironmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "peerAuthentication", m.PeerAuthentication) populate(objectMap, "peerTrafficConfiguration", m.PeerTrafficConfiguration) populate(objectMap, "privateEndpointConnections", m.PrivateEndpointConnections) + populate(objectMap, "privateLinkDefaultDomain", m.PrivateLinkDefaultDomain) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) populate(objectMap, "staticIp", m.StaticIP) @@ -8110,6 +8821,9 @@ func (m *ManagedEnvironmentProperties) UnmarshalJSON(data []byte) error { case "appLogsConfiguration": err = unpopulate(val, "AppLogsConfiguration", &m.AppLogsConfiguration) delete(rawMsg, key) + case "availabilityZones": + err = unpopulate(val, "AvailabilityZones", &m.AvailabilityZones) + delete(rawMsg, key) case "customDomainConfiguration": err = unpopulate(val, "CustomDomainConfiguration", &m.CustomDomainConfiguration) delete(rawMsg, key) @@ -8149,6 +8863,9 @@ func (m *ManagedEnvironmentProperties) UnmarshalJSON(data []byte) error { case "privateEndpointConnections": err = unpopulate(val, "PrivateEndpointConnections", &m.PrivateEndpointConnections) delete(rawMsg, key) + case "privateLinkDefaultDomain": + err = unpopulate(val, "PrivateLinkDefaultDomain", &m.PrivateLinkDefaultDomain) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) delete(rawMsg, key) @@ -8388,6 +9105,37 @@ func (m *ManagedEnvironmentsCollection) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedIdentitySetting. +func (m ManagedIdentitySetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "lifecycle", m.Lifecycle) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedIdentitySetting. +func (m *ManagedIdentitySetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) + case "lifecycle": + err = unpopulate(val, "Lifecycle", &m.Lifecycle) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -9930,6 +10678,7 @@ func (r RevisionProperties) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "createdTime", r.CreatedTime) populate(objectMap, "fqdn", r.Fqdn) populate(objectMap, "healthState", r.HealthState) + populate(objectMap, "labels", r.Labels) populateDateTimeRFC3339(objectMap, "lastActiveTime", r.LastActiveTime) populate(objectMap, "provisioningError", r.ProvisioningError) populate(objectMap, "provisioningState", r.ProvisioningState) @@ -9961,6 +10710,9 @@ func (r *RevisionProperties) UnmarshalJSON(data []byte) error { case "healthState": err = unpopulate(val, "HealthState", &r.HealthState) delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &r.Labels) + delete(rawMsg, key) case "lastActiveTime": err = unpopulateDateTimeRFC3339(val, "LastActiveTime", &r.LastActiveTime) delete(rawMsg, key) @@ -10328,6 +11080,68 @@ func (s *ScgRoute) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ScheduledEntries. +func (s ScheduledEntries) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scheduledEntries", s.ScheduledEntries) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledEntries. +func (s *ScheduledEntries) UnmarshalJSON(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 "scheduledEntries": + err = unpopulate(val, "ScheduledEntries", &s.ScheduledEntries) + 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 ScheduledEntry. +func (s ScheduledEntry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "durationHours", s.DurationHours) + populate(objectMap, "startHourUtc", s.StartHourUTC) + populate(objectMap, "weekDay", s.WeekDay) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledEntry. +func (s *ScheduledEntry) UnmarshalJSON(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 "durationHours": + err = unpopulate(val, "DurationHours", &s.DurationHours) + delete(rawMsg, key) + case "startHourUtc": + err = unpopulate(val, "StartHourUTC", &s.StartHourUTC) + delete(rawMsg, key) + case "weekDay": + err = unpopulate(val, "WeekDay", &s.WeekDay) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Secret. func (s Secret) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10627,6 +11441,7 @@ func (s *SessionNetworkConfiguration) UnmarshalJSON(data []byte) error { func (s SessionPool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -10648,6 +11463,9 @@ func (s *SessionPool) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -10712,6 +11530,7 @@ func (s SessionPoolProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "customContainerTemplate", s.CustomContainerTemplate) populate(objectMap, "dynamicPoolConfiguration", s.DynamicPoolConfiguration) populate(objectMap, "environmentId", s.EnvironmentID) + populate(objectMap, "managedIdentitySettings", s.ManagedIdentitySettings) populate(objectMap, "nodeCount", s.NodeCount) populate(objectMap, "poolManagementEndpoint", s.PoolManagementEndpoint) populate(objectMap, "poolManagementType", s.PoolManagementType) @@ -10743,6 +11562,9 @@ func (s *SessionPoolProperties) UnmarshalJSON(data []byte) error { case "environmentId": err = unpopulate(val, "EnvironmentID", &s.EnvironmentID) delete(rawMsg, key) + case "managedIdentitySettings": + err = unpopulate(val, "ManagedIdentitySettings", &s.ManagedIdentitySettings) + delete(rawMsg, key) case "nodeCount": err = unpopulate(val, "NodeCount", &s.NodeCount) delete(rawMsg, key) @@ -10806,6 +11628,7 @@ func (s *SessionPoolSecret) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SessionPoolUpdatableProperties. func (s SessionPoolUpdatableProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", s.Identity) populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } @@ -10819,6 +11642,9 @@ func (s *SessionPoolUpdatableProperties) 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 "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go index 555790d5339d..f040d1c0c880 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // NamespacesClient contains the methods for the Namespaces group. @@ -47,7 +46,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 2024-08-02-preview +// Generated from API version 2024-10-02-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. @@ -95,7 +94,7 @@ func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, checkNameAvailabilityRequest); err != nil { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go deleted file mode 100644 index 6b9bf7398870..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go +++ /dev/null @@ -1,75 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_CheckNameAvailability.json -func ExampleNamespacesClient_CheckNameAvailability_certificatesCheckNameAvailability() { - 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.NewNamespacesClient().CheckNameAvailability(ctx, "examplerg", "testcontainerenv", armappcontainers.CheckNameAvailabilityRequest{ - Name: to.Ptr("testcertificatename"), - Type: to.Ptr("Microsoft.App/managedEnvironments/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")), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_CheckNameAvailability.json -func ExampleNamespacesClient_CheckNameAvailability_containerAppsCheckNameAvailability() { - 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.NewNamespacesClient().CheckNameAvailability(ctx, "examplerg", "testcontainerenv", armappcontainers.CheckNameAvailabilityRequest{ - Name: to.Ptr("testcappname"), - Type: to.Ptr("Microsoft.App/containerApps"), - }, 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/operations_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go index 4ce6487a983e..5f79ef6e24e8 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go @@ -10,12 +10,11 @@ package armappcontainers import ( "context" - "net/http" - "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" ) // OperationsClient contains the methods for the Operations group. @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available RP operations. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-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]{ @@ -73,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-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 deleted file mode 100644 index 24b9a1a27e7f..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client_example_test.go +++ /dev/null @@ -1,56 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Operations_List.json -func ExampleOperationsClient_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.NewOperationsClient().NewListPager(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.AvailableOperations = armappcontainers.AvailableOperations{ - // Value: []*armappcontainers.OperationDetail{ - // { - // Name: to.Ptr("Microsoft.App/containerApps/Read"), - // Display: &armappcontainers.OperationDisplay{ - // Description: to.Ptr("Get the properties of a Container App"), - // Operation: to.Ptr("Get Container App"), - // Provider: to.Ptr("Microsoft Apps"), - // Resource: to.Ptr("Container App"), - // }, - // Origin: to.Ptr("user,system"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/options.go b/sdk/resourcemanager/appcontainers/armappcontainers/options.go index 9afc10537e59..cfc8c8206e26 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/options.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/options.go @@ -133,17 +133,28 @@ type CertificatesClientUpdateOptions struct { // placeholder for future optional parameters } -// ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.CreateOrUpdate +// ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.BeginCreateOrUpdate // method. -type ConnectedEnvironmentsCertificatesClientCreateOrUpdateOptions struct { +type ConnectedEnvironmentsCertificatesClientBeginCreateOrUpdateOptions struct { // Certificate to be created or updated CertificateEnvelope *Certificate + + // Resumes the LRO from the provided token. + ResumeToken string } -// ConnectedEnvironmentsCertificatesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Delete +// ConnectedEnvironmentsCertificatesClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.BeginDelete // method. -type ConnectedEnvironmentsCertificatesClientDeleteOptions struct { - // placeholder for future optional parameters +type ConnectedEnvironmentsCertificatesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectedEnvironmentsCertificatesClientBeginUpdateOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.BeginUpdate +// method. +type ConnectedEnvironmentsCertificatesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } // ConnectedEnvironmentsCertificatesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsCertificatesClient.Get @@ -158,12 +169,6 @@ 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 { @@ -206,16 +211,18 @@ type ConnectedEnvironmentsClientUpdateOptions struct { // placeholder for future optional parameters } -// ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate +// ConnectedEnvironmentsDaprComponentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.BeginCreateOrUpdate // method. -type ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters +type ConnectedEnvironmentsDaprComponentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// ConnectedEnvironmentsDaprComponentsClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Delete +// ConnectedEnvironmentsDaprComponentsClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.BeginDelete // method. -type ConnectedEnvironmentsDaprComponentsClientDeleteOptions struct { - // placeholder for future optional parameters +type ConnectedEnvironmentsDaprComponentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } // ConnectedEnvironmentsDaprComponentsClientGetOptions contains the optional parameters for the ConnectedEnvironmentsDaprComponentsClient.Get @@ -236,16 +243,18 @@ type ConnectedEnvironmentsDaprComponentsClientListSecretsOptions struct { // placeholder for future optional parameters } -// ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.CreateOrUpdate +// ConnectedEnvironmentsStoragesClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.BeginCreateOrUpdate // method. -type ConnectedEnvironmentsStoragesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters +type ConnectedEnvironmentsStoragesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// ConnectedEnvironmentsStoragesClientDeleteOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Delete +// ConnectedEnvironmentsStoragesClientBeginDeleteOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.BeginDelete // method. -type ConnectedEnvironmentsStoragesClientDeleteOptions struct { - // placeholder for future optional parameters +type ConnectedEnvironmentsStoragesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } // ConnectedEnvironmentsStoragesClientGetOptions contains the optional parameters for the ConnectedEnvironmentsStoragesClient.Get @@ -409,6 +418,19 @@ type ContainerAppsDiagnosticsClientListRevisionsOptions struct { Filter *string } +// ContainerAppsLabelHistoryClientGetLabelHistoryOptions contains the optional parameters for the ContainerAppsLabelHistoryClient.GetLabelHistory +// method. +type ContainerAppsLabelHistoryClientGetLabelHistoryOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsLabelHistoryClientListLabelHistoryOptions contains the optional parameters for the ContainerAppsLabelHistoryClient.NewListLabelHistoryPager +// method. +type ContainerAppsLabelHistoryClientListLabelHistoryOptions struct { + // The filter to apply on the operation. + Filter *string +} + // ContainerAppsPatchesClientBeginApplyOptions contains the optional parameters for the ContainerAppsPatchesClient.BeginApply // method. type ContainerAppsPatchesClientBeginApplyOptions struct { @@ -668,6 +690,33 @@ type FunctionsExtensionClientInvokeFunctionsHostOptions struct { // placeholder for future optional parameters } +// HTTPRouteConfigClientCreateOrUpdateOptions contains the optional parameters for the HTTPRouteConfigClient.CreateOrUpdate +// method. +type HTTPRouteConfigClientCreateOrUpdateOptions struct { + // Http Route config to be created or updated + HTTPRouteConfigEnvelope *HTTPRouteConfig +} + +// HTTPRouteConfigClientDeleteOptions contains the optional parameters for the HTTPRouteConfigClient.Delete method. +type HTTPRouteConfigClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// HTTPRouteConfigClientGetOptions contains the optional parameters for the HTTPRouteConfigClient.Get method. +type HTTPRouteConfigClientGetOptions struct { + // placeholder for future optional parameters +} + +// HTTPRouteConfigClientListOptions contains the optional parameters for the HTTPRouteConfigClient.NewListPager method. +type HTTPRouteConfigClientListOptions struct { + // placeholder for future optional parameters +} + +// HTTPRouteConfigClientUpdateOptions contains the optional parameters for the HTTPRouteConfigClient.Update method. +type HTTPRouteConfigClientUpdateOptions struct { + // placeholder for future optional parameters +} + // JavaComponentsClientBeginCreateOrUpdateOptions contains the optional parameters for the JavaComponentsClient.BeginCreateOrUpdate // method. type JavaComponentsClientBeginCreateOrUpdateOptions struct { @@ -833,6 +882,30 @@ type LogicAppsClientListWorkflowsOptions struct { // placeholder for future optional parameters } +// MaintenanceConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the MaintenanceConfigurationsClient.CreateOrUpdate +// method. +type MaintenanceConfigurationsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceConfigurationsClientDeleteOptions contains the optional parameters for the MaintenanceConfigurationsClient.Delete +// method. +type MaintenanceConfigurationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceConfigurationsClientGetOptions contains the optional parameters for the MaintenanceConfigurationsClient.Get +// method. +type MaintenanceConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceConfigurationsClientListOptions contains the optional parameters for the MaintenanceConfigurationsClient.NewListPager +// method. +type MaintenanceConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + // ManagedCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedCertificatesClient.BeginCreateOrUpdate // method. type ManagedCertificatesClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/responses.go b/sdk/resourcemanager/appcontainers/armappcontainers/responses.go index 2c8ca17c0040..e09cb9ac5739 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/responses.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/responses.go @@ -142,13 +142,13 @@ type CertificatesClientUpdateResponse struct { Certificate } -// ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsCertificatesClient.CreateOrUpdate. +// ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsCertificatesClient.BeginCreateOrUpdate. type ConnectedEnvironmentsCertificatesClientCreateOrUpdateResponse struct { // Certificate used for Custom Domain bindings of Container Apps in a Managed Environment Certificate } -// ConnectedEnvironmentsCertificatesClientDeleteResponse contains the response from method ConnectedEnvironmentsCertificatesClient.Delete. +// ConnectedEnvironmentsCertificatesClientDeleteResponse contains the response from method ConnectedEnvironmentsCertificatesClient.BeginDelete. type ConnectedEnvironmentsCertificatesClientDeleteResponse struct { // placeholder for future response values } @@ -165,7 +165,7 @@ type ConnectedEnvironmentsCertificatesClientListResponse struct { CertificateCollection } -// ConnectedEnvironmentsCertificatesClientUpdateResponse contains the response from method ConnectedEnvironmentsCertificatesClient.Update. +// ConnectedEnvironmentsCertificatesClientUpdateResponse contains the response from method ConnectedEnvironmentsCertificatesClient.BeginUpdate. type ConnectedEnvironmentsCertificatesClientUpdateResponse struct { // Certificate used for Custom Domain bindings of Container Apps in a Managed Environment Certificate @@ -212,13 +212,13 @@ type ConnectedEnvironmentsClientUpdateResponse struct { ConnectedEnvironment } -// ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.CreateOrUpdate. +// ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.BeginCreateOrUpdate. type ConnectedEnvironmentsDaprComponentsClientCreateOrUpdateResponse struct { // Dapr Component. - DaprComponent + ConnectedEnvironmentDaprComponent } -// ConnectedEnvironmentsDaprComponentsClientDeleteResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.Delete. +// ConnectedEnvironmentsDaprComponentsClientDeleteResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.BeginDelete. type ConnectedEnvironmentsDaprComponentsClientDeleteResponse struct { // placeholder for future response values } @@ -226,13 +226,13 @@ type ConnectedEnvironmentsDaprComponentsClientDeleteResponse struct { // ConnectedEnvironmentsDaprComponentsClientGetResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.Get. type ConnectedEnvironmentsDaprComponentsClientGetResponse struct { // Dapr Component. - DaprComponent + ConnectedEnvironmentDaprComponent } // ConnectedEnvironmentsDaprComponentsClientListResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.NewListPager. type ConnectedEnvironmentsDaprComponentsClientListResponse struct { - // Dapr Components ARM resource. - DaprComponentsCollection + // Collection of Dapr Components for Environments + ConnectedEnvironmentDaprComponentsCollection } // ConnectedEnvironmentsDaprComponentsClientListSecretsResponse contains the response from method ConnectedEnvironmentsDaprComponentsClient.ListSecrets. @@ -241,13 +241,13 @@ type ConnectedEnvironmentsDaprComponentsClientListSecretsResponse struct { DaprSecretsCollection } -// ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsStoragesClient.CreateOrUpdate. +// ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse contains the response from method ConnectedEnvironmentsStoragesClient.BeginCreateOrUpdate. type ConnectedEnvironmentsStoragesClientCreateOrUpdateResponse struct { // Storage resource for connectedEnvironment. ConnectedEnvironmentStorage } -// ConnectedEnvironmentsStoragesClientDeleteResponse contains the response from method ConnectedEnvironmentsStoragesClient.Delete. +// ConnectedEnvironmentsStoragesClientDeleteResponse contains the response from method ConnectedEnvironmentsStoragesClient.BeginDelete. type ConnectedEnvironmentsStoragesClientDeleteResponse struct { // placeholder for future response values } @@ -411,6 +411,18 @@ type ContainerAppsDiagnosticsClientListRevisionsResponse struct { RevisionCollection } +// ContainerAppsLabelHistoryClientGetLabelHistoryResponse contains the response from method ContainerAppsLabelHistoryClient.GetLabelHistory. +type ContainerAppsLabelHistoryClientGetLabelHistoryResponse struct { + // Container App Label History. + LabelHistory +} + +// ContainerAppsLabelHistoryClientListLabelHistoryResponse contains the response from method ContainerAppsLabelHistoryClient.NewListLabelHistoryPager. +type ContainerAppsLabelHistoryClientListLabelHistoryResponse struct { + // Container App Label History collection ARM resource. + LabelHistoryCollection +} + // ContainerAppsPatchesClientApplyResponse contains the response from method ContainerAppsPatchesClient.BeginApply. type ContainerAppsPatchesClientApplyResponse struct { // Container App Patch @@ -645,6 +657,35 @@ type FunctionsExtensionClientInvokeFunctionsHostResponse struct { Value *string } +// HTTPRouteConfigClientCreateOrUpdateResponse contains the response from method HTTPRouteConfigClient.CreateOrUpdate. +type HTTPRouteConfigClientCreateOrUpdateResponse struct { + // Advanced Ingress routing for path/header based routing for a Container App Environment + HTTPRouteConfig +} + +// HTTPRouteConfigClientDeleteResponse contains the response from method HTTPRouteConfigClient.Delete. +type HTTPRouteConfigClientDeleteResponse struct { + // placeholder for future response values +} + +// HTTPRouteConfigClientGetResponse contains the response from method HTTPRouteConfigClient.Get. +type HTTPRouteConfigClientGetResponse struct { + // Advanced Ingress routing for path/header based routing for a Container App Environment + HTTPRouteConfig +} + +// HTTPRouteConfigClientListResponse contains the response from method HTTPRouteConfigClient.NewListPager. +type HTTPRouteConfigClientListResponse struct { + // Collection of Advanced Ingress Routing Config resources. + HTTPRouteConfigCollection +} + +// HTTPRouteConfigClientUpdateResponse contains the response from method HTTPRouteConfigClient.Update. +type HTTPRouteConfigClientUpdateResponse struct { + // Advanced Ingress routing for path/header based routing for a Container App Environment + HTTPRouteConfig +} + // JavaComponentsClientCreateOrUpdateResponse contains the response from method JavaComponentsClient.BeginCreateOrUpdate. type JavaComponentsClientCreateOrUpdateResponse struct { // Java Component. @@ -814,6 +855,29 @@ type LogicAppsClientListWorkflowsResponse struct { WorkflowEnvelopeCollection } +// MaintenanceConfigurationsClientCreateOrUpdateResponse contains the response from method MaintenanceConfigurationsClient.CreateOrUpdate. +type MaintenanceConfigurationsClientCreateOrUpdateResponse struct { + // Information about the Maintenance Configuration resource. + MaintenanceConfigurationResource +} + +// MaintenanceConfigurationsClientDeleteResponse contains the response from method MaintenanceConfigurationsClient.Delete. +type MaintenanceConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// MaintenanceConfigurationsClientGetResponse contains the response from method MaintenanceConfigurationsClient.Get. +type MaintenanceConfigurationsClientGetResponse struct { + // Information about the Maintenance Configuration resource. + MaintenanceConfigurationResource +} + +// MaintenanceConfigurationsClientListResponse contains the response from method MaintenanceConfigurationsClient.NewListPager. +type MaintenanceConfigurationsClientListResponse struct { + // The response of list maintenance configuration resources. + MaintenanceConfigurationCollection +} + // ManagedCertificatesClientCreateOrUpdateResponse contains the response from method ManagedCertificatesClient.BeginCreateOrUpdate. type ManagedCertificatesClientCreateOrUpdateResponse struct { // Managed certificates used for Custom Domain bindings of Container Apps in a Managed Environment diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/time_rfc3339.go b/sdk/resourcemanager/appcontainers/armappcontainers/time_rfc3339.go index 38c2fcaebc44..947aa91dde53 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/time_rfc3339.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/time_rfc3339.go @@ -11,12 +11,11 @@ package armappcontainers import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/usages_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/usages_client.go index 4788ab98995a..c261102c36dc 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/usages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/usages_client.go @@ -11,14 +11,13 @@ package armappcontainers import ( "context" "errors" - "net/http" - "net/url" - "strings" - "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" ) // UsagesClient contains the methods for the Usages group. @@ -47,7 +46,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - Gets, for the specified location, the current resource usage information as well as the limits under the // subscription. // -// Generated from API version 2024-08-02-preview +// Generated from API version 2024-10-02-preview // - location - The location for which resource usage is queried. // - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { @@ -89,7 +88,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-02-preview") + reqQP.Set("api-version", "2024-10-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/usages_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/usages_client_example_test.go deleted file mode 100644 index d3961eb14584..000000000000 --- a/sdk/resourcemanager/appcontainers/armappcontainers/usages_client_example_test.go +++ /dev/null @@ -1,64 +0,0 @@ -//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/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Usages_List.json -func ExampleUsagesClient_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.NewUsagesClient().NewListPager("westus", 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.ListUsagesResult = armappcontainers.ListUsagesResult{ - // Value: []*armappcontainers.Usage{ - // { - // Name: &armappcontainers.UsageName{ - // LocalizedValue: to.Ptr("ManagedEnvironmentCount"), - // Value: to.Ptr("ManagedEnvironmentCount"), - // }, - // CurrentValue: to.Ptr[float32](5), - // Limit: to.Ptr[float32](10), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: &armappcontainers.UsageName{ - // LocalizedValue: to.Ptr("ManagedEnvironmentCores"), - // Value: to.Ptr("ManagedEnvironmentCores"), - // }, - // CurrentValue: to.Ptr[float32](3), - // Limit: to.Ptr[float32](20), - // Unit: to.Ptr("Count"), - // }}, - // } - } -}