diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md b/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md index ebae90abf7..de3024fb26 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md +++ b/sdk/resourcemanager/appcontainers/armappcontainers/CHANGELOG.md @@ -1,5 +1,300 @@ # Release History +## 3.1.0-beta.1 (2024-10-23) +### Features Added + +- New value `StorageTypeNfsAzureFile`, `StorageTypeSmb` added to enum type `StorageType` +- New enum type `BuildProvisioningState` with values `BuildProvisioningStateCanceled`, `BuildProvisioningStateCreating`, `BuildProvisioningStateDeleting`, `BuildProvisioningStateFailed`, `BuildProvisioningStateSucceeded`, `BuildProvisioningStateUpdating` +- New enum type `BuildStatus` with values `BuildStatusCanceled`, `BuildStatusFailed`, `BuildStatusInProgress`, `BuildStatusNotStarted`, `BuildStatusSucceeded` +- New enum type `BuilderProvisioningState` with values `BuilderProvisioningStateCanceled`, `BuilderProvisioningStateCreating`, `BuilderProvisioningStateDeleting`, `BuilderProvisioningStateFailed`, `BuilderProvisioningStateSucceeded`, `BuilderProvisioningStateUpdating` +- New enum type `CertificateType` with values `CertificateTypeImagePullTrustedCA`, `CertificateTypeServerSSLCertificate` +- New enum type `ContainerType` with values `ContainerTypeCustomContainer`, `ContainerTypePythonLTS` +- New enum type `DetectionStatus` with values `DetectionStatusFailed`, `DetectionStatusRegistryLoginFailed`, `DetectionStatusSucceeded` +- New enum type `DotNetComponentProvisioningState` with values `DotNetComponentProvisioningStateCanceled`, `DotNetComponentProvisioningStateDeleting`, `DotNetComponentProvisioningStateFailed`, `DotNetComponentProvisioningStateInProgress`, `DotNetComponentProvisioningStateSucceeded` +- New enum type `DotNetComponentType` with values `DotNetComponentTypeAspireDashboard` +- New enum type `ExecutionType` with values `ExecutionTypeTimed` +- New enum type `IdentitySettingsLifeCycle` with values `IdentitySettingsLifeCycleAll`, `IdentitySettingsLifeCycleInit`, `IdentitySettingsLifeCycleMain`, `IdentitySettingsLifeCycleNone` +- New enum type `ImageType` with values `ImageTypeCloudBuild`, `ImageTypeContainerImage` +- New enum type `IngressTargetPortHTTPScheme` with values `IngressTargetPortHTTPSchemeHTTP`, `IngressTargetPortHTTPSchemeHTTPS` +- New enum type `JavaComponentProvisioningState` with values `JavaComponentProvisioningStateCanceled`, `JavaComponentProvisioningStateDeleting`, `JavaComponentProvisioningStateFailed`, `JavaComponentProvisioningStateInProgress`, `JavaComponentProvisioningStateSucceeded` +- New enum type `JavaComponentType` with values `JavaComponentTypeNacos`, `JavaComponentTypeSpringBootAdmin`, `JavaComponentTypeSpringCloudConfig`, `JavaComponentTypeSpringCloudEureka`, `JavaComponentTypeSpringCloudGateway` +- New enum type `JobRunningState` with values `JobRunningStateProgressing`, `JobRunningStateReady`, `JobRunningStateSuspended` +- New enum type `Kind` with values `KindWorkflowapp` +- New enum type `Level` with values `LevelDebug`, `LevelError`, `LevelInfo`, `LevelOff`, `LevelTrace`, `LevelWarn` +- New enum type `LogicAppsProxyMethod` with values `LogicAppsProxyMethodGET`, `LogicAppsProxyMethodPOST` +- New enum type `PatchApplyStatus` with values `PatchApplyStatusCanceled`, `PatchApplyStatusCreatingRevision`, `PatchApplyStatusImagePushPullFailed`, `PatchApplyStatusManuallySkipped`, `PatchApplyStatusNotStarted`, `PatchApplyStatusRebaseFailed`, `PatchApplyStatusRebaseInProgress`, `PatchApplyStatusRevisionCreationFailed`, `PatchApplyStatusSucceeded` +- New enum type `PatchType` with values `PatchTypeFrameworkAndOSSecurity`, `PatchTypeFrameworkSecurity`, `PatchTypeOSSecurity`, `PatchTypeOther` +- New enum type `PatchingMode` with values `PatchingModeAutomatic`, `PatchingModeDisabled`, `PatchingModeManual` +- New enum type `PoolManagementType` with values `PoolManagementTypeDynamic`, `PoolManagementTypeManual` +- New enum type `PrivateEndpointConnectionProvisioningState` with values `PrivateEndpointConnectionProvisioningStateCanceled`, `PrivateEndpointConnectionProvisioningStateDeleting`, `PrivateEndpointConnectionProvisioningStateFailed`, `PrivateEndpointConnectionProvisioningStatePending`, `PrivateEndpointConnectionProvisioningStateSucceeded`, `PrivateEndpointConnectionProvisioningStateUpdating`, `PrivateEndpointConnectionProvisioningStateWaiting` +- New enum type `PrivateEndpointServiceConnectionStatus` with values `PrivateEndpointServiceConnectionStatusApproved`, `PrivateEndpointServiceConnectionStatusDisconnected`, `PrivateEndpointServiceConnectionStatusPending`, `PrivateEndpointServiceConnectionStatusRejected` +- New enum type `PublicNetworkAccess` with values `PublicNetworkAccessDisabled`, `PublicNetworkAccessEnabled` +- New enum type `SessionNetworkStatus` with values `SessionNetworkStatusEgressDisabled`, `SessionNetworkStatusEgressEnabled` +- New enum type `SessionPoolProvisioningState` with values `SessionPoolProvisioningStateCanceled`, `SessionPoolProvisioningStateDeleting`, `SessionPoolProvisioningStateFailed`, `SessionPoolProvisioningStateInProgress`, `SessionPoolProvisioningStateSucceeded` +- New enum type `WorkflowHealthState` with values `WorkflowHealthStateHealthy`, `WorkflowHealthStateNotSpecified`, `WorkflowHealthStateUnhealthy`, `WorkflowHealthStateUnknown` +- New enum type `WorkflowState` with values `WorkflowStateCompleted`, `WorkflowStateDeleted`, `WorkflowStateDisabled`, `WorkflowStateEnabled`, `WorkflowStateNotSpecified`, `WorkflowStateSuspended` +- New function `NewAppResiliencyClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AppResiliencyClient, error)` +- New function `*AppResiliencyClient.CreateOrUpdate(context.Context, string, string, string, AppResiliency, *AppResiliencyClientCreateOrUpdateOptions) (AppResiliencyClientCreateOrUpdateResponse, error)` +- New function `*AppResiliencyClient.Delete(context.Context, string, string, string, *AppResiliencyClientDeleteOptions) (AppResiliencyClientDeleteResponse, error)` +- New function `*AppResiliencyClient.Get(context.Context, string, string, string, *AppResiliencyClientGetOptions) (AppResiliencyClientGetResponse, error)` +- New function `*AppResiliencyClient.NewListPager(string, string, *AppResiliencyClientListOptions) *runtime.Pager[AppResiliencyClientListResponse]` +- New function `*AppResiliencyClient.Update(context.Context, string, string, string, AppResiliency, *AppResiliencyClientUpdateOptions) (AppResiliencyClientUpdateResponse, error)` +- New function `NewBuildAuthTokenClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BuildAuthTokenClient, error)` +- New function `*BuildAuthTokenClient.List(context.Context, string, string, string, *BuildAuthTokenClientListOptions) (BuildAuthTokenClientListResponse, error)` +- New function `NewBuildersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BuildersClient, error)` +- New function `*BuildersClient.BeginCreateOrUpdate(context.Context, string, string, BuilderResource, *BuildersClientBeginCreateOrUpdateOptions) (*runtime.Poller[BuildersClientCreateOrUpdateResponse], error)` +- New function `*BuildersClient.BeginDelete(context.Context, string, string, *BuildersClientBeginDeleteOptions) (*runtime.Poller[BuildersClientDeleteResponse], error)` +- New function `*BuildersClient.Get(context.Context, string, string, *BuildersClientGetOptions) (BuildersClientGetResponse, error)` +- New function `*BuildersClient.NewListByResourceGroupPager(string, *BuildersClientListByResourceGroupOptions) *runtime.Pager[BuildersClientListByResourceGroupResponse]` +- New function `*BuildersClient.NewListBySubscriptionPager(*BuildersClientListBySubscriptionOptions) *runtime.Pager[BuildersClientListBySubscriptionResponse]` +- New function `*BuildersClient.BeginUpdate(context.Context, string, string, BuilderResourceUpdate, *BuildersClientBeginUpdateOptions) (*runtime.Poller[BuildersClientUpdateResponse], error)` +- New function `NewBuildsByBuilderResourceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BuildsByBuilderResourceClient, error)` +- New function `*BuildsByBuilderResourceClient.NewListPager(string, string, *BuildsByBuilderResourceClientListOptions) *runtime.Pager[BuildsByBuilderResourceClientListResponse]` +- New function `NewBuildsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BuildsClient, error)` +- New function `*BuildsClient.BeginCreateOrUpdate(context.Context, string, string, string, BuildResource, *BuildsClientBeginCreateOrUpdateOptions) (*runtime.Poller[BuildsClientCreateOrUpdateResponse], error)` +- New function `*BuildsClient.BeginDelete(context.Context, string, string, string, *BuildsClientBeginDeleteOptions) (*runtime.Poller[BuildsClientDeleteResponse], error)` +- New function `*BuildsClient.Get(context.Context, string, string, string, *BuildsClientGetOptions) (BuildsClientGetResponse, error)` +- New function `*ClientFactory.NewAppResiliencyClient() *AppResiliencyClient` +- New function `*ClientFactory.NewBuildAuthTokenClient() *BuildAuthTokenClient` +- New function `*ClientFactory.NewBuildersClient() *BuildersClient` +- New function `*ClientFactory.NewBuildsByBuilderResourceClient() *BuildsByBuilderResourceClient` +- New function `*ClientFactory.NewBuildsClient() *BuildsClient` +- New function `*ClientFactory.NewContainerAppsBuildsByContainerAppClient() *ContainerAppsBuildsByContainerAppClient` +- New function `*ClientFactory.NewContainerAppsBuildsClient() *ContainerAppsBuildsClient` +- New function `*ClientFactory.NewContainerAppsPatchesClient() *ContainerAppsPatchesClient` +- New function `*ClientFactory.NewContainerAppsSessionPoolsClient() *ContainerAppsSessionPoolsClient` +- New function `*ClientFactory.NewDaprComponentResiliencyPoliciesClient() *DaprComponentResiliencyPoliciesClient` +- New function `*ClientFactory.NewDaprSubscriptionsClient() *DaprSubscriptionsClient` +- New function `*ClientFactory.NewDotNetComponentsClient() *DotNetComponentsClient` +- New function `*ClientFactory.NewFunctionsExtensionClient() *FunctionsExtensionClient` +- New function `*ClientFactory.NewJavaComponentsClient() *JavaComponentsClient` +- New function `*ClientFactory.NewLogicAppsClient() *LogicAppsClient` +- New function `*ClientFactory.NewManagedEnvironmentPrivateEndpointConnectionsClient() *ManagedEnvironmentPrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewManagedEnvironmentPrivateLinkResourcesClient() *ManagedEnvironmentPrivateLinkResourcesClient` +- New function `NewContainerAppsBuildsByContainerAppClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContainerAppsBuildsByContainerAppClient, error)` +- New function `*ContainerAppsBuildsByContainerAppClient.NewListPager(string, string, *ContainerAppsBuildsByContainerAppClientListOptions) *runtime.Pager[ContainerAppsBuildsByContainerAppClientListResponse]` +- New function `NewContainerAppsBuildsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContainerAppsBuildsClient, error)` +- New function `*ContainerAppsBuildsClient.BeginDelete(context.Context, string, string, string, *ContainerAppsBuildsClientBeginDeleteOptions) (*runtime.Poller[ContainerAppsBuildsClientDeleteResponse], error)` +- New function `*ContainerAppsBuildsClient.Get(context.Context, string, string, string, *ContainerAppsBuildsClientGetOptions) (ContainerAppsBuildsClientGetResponse, error)` +- New function `NewContainerAppsPatchesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContainerAppsPatchesClient, error)` +- New function `*ContainerAppsPatchesClient.BeginApply(context.Context, string, string, string, *ContainerAppsPatchesClientBeginApplyOptions) (*runtime.Poller[ContainerAppsPatchesClientApplyResponse], error)` +- New function `*ContainerAppsPatchesClient.BeginDelete(context.Context, string, string, string, *ContainerAppsPatchesClientBeginDeleteOptions) (*runtime.Poller[ContainerAppsPatchesClientDeleteResponse], error)` +- New function `*ContainerAppsPatchesClient.Get(context.Context, string, string, string, *ContainerAppsPatchesClientGetOptions) (ContainerAppsPatchesClientGetResponse, error)` +- New function `*ContainerAppsPatchesClient.NewListByContainerAppPager(string, string, *ContainerAppsPatchesClientListByContainerAppOptions) *runtime.Pager[ContainerAppsPatchesClientListByContainerAppResponse]` +- New function `*ContainerAppsPatchesClient.BeginSkipConfigure(context.Context, string, string, string, PatchSkipConfig, *ContainerAppsPatchesClientBeginSkipConfigureOptions) (*runtime.Poller[ContainerAppsPatchesClientSkipConfigureResponse], error)` +- New function `NewContainerAppsSessionPoolsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContainerAppsSessionPoolsClient, error)` +- New function `*ContainerAppsSessionPoolsClient.BeginCreateOrUpdate(context.Context, string, string, SessionPool, *ContainerAppsSessionPoolsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ContainerAppsSessionPoolsClientCreateOrUpdateResponse], error)` +- New function `*ContainerAppsSessionPoolsClient.BeginDelete(context.Context, string, string, *ContainerAppsSessionPoolsClientBeginDeleteOptions) (*runtime.Poller[ContainerAppsSessionPoolsClientDeleteResponse], error)` +- New function `*ContainerAppsSessionPoolsClient.Get(context.Context, string, string, *ContainerAppsSessionPoolsClientGetOptions) (ContainerAppsSessionPoolsClientGetResponse, error)` +- New function `*ContainerAppsSessionPoolsClient.NewListByResourceGroupPager(string, *ContainerAppsSessionPoolsClientListByResourceGroupOptions) *runtime.Pager[ContainerAppsSessionPoolsClientListByResourceGroupResponse]` +- New function `*ContainerAppsSessionPoolsClient.NewListBySubscriptionPager(*ContainerAppsSessionPoolsClientListBySubscriptionOptions) *runtime.Pager[ContainerAppsSessionPoolsClientListBySubscriptionResponse]` +- New function `*ContainerAppsSessionPoolsClient.BeginUpdate(context.Context, string, string, SessionPoolUpdatableProperties, *ContainerAppsSessionPoolsClientBeginUpdateOptions) (*runtime.Poller[ContainerAppsSessionPoolsClientUpdateResponse], error)` +- New function `NewDaprComponentResiliencyPoliciesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DaprComponentResiliencyPoliciesClient, error)` +- New function `*DaprComponentResiliencyPoliciesClient.CreateOrUpdate(context.Context, string, string, string, string, DaprComponentResiliencyPolicy, *DaprComponentResiliencyPoliciesClientCreateOrUpdateOptions) (DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse, error)` +- New function `*DaprComponentResiliencyPoliciesClient.Delete(context.Context, string, string, string, string, *DaprComponentResiliencyPoliciesClientDeleteOptions) (DaprComponentResiliencyPoliciesClientDeleteResponse, error)` +- New function `*DaprComponentResiliencyPoliciesClient.Get(context.Context, string, string, string, string, *DaprComponentResiliencyPoliciesClientGetOptions) (DaprComponentResiliencyPoliciesClientGetResponse, error)` +- New function `*DaprComponentResiliencyPoliciesClient.NewListPager(string, string, string, *DaprComponentResiliencyPoliciesClientListOptions) *runtime.Pager[DaprComponentResiliencyPoliciesClientListResponse]` +- New function `NewDaprSubscriptionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DaprSubscriptionsClient, error)` +- New function `*DaprSubscriptionsClient.CreateOrUpdate(context.Context, string, string, string, DaprSubscription, *DaprSubscriptionsClientCreateOrUpdateOptions) (DaprSubscriptionsClientCreateOrUpdateResponse, error)` +- New function `*DaprSubscriptionsClient.Delete(context.Context, string, string, string, *DaprSubscriptionsClientDeleteOptions) (DaprSubscriptionsClientDeleteResponse, error)` +- New function `*DaprSubscriptionsClient.Get(context.Context, string, string, string, *DaprSubscriptionsClientGetOptions) (DaprSubscriptionsClientGetResponse, error)` +- New function `*DaprSubscriptionsClient.NewListPager(string, string, *DaprSubscriptionsClientListOptions) *runtime.Pager[DaprSubscriptionsClientListResponse]` +- New function `NewDotNetComponentsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DotNetComponentsClient, error)` +- New function `*DotNetComponentsClient.BeginCreateOrUpdate(context.Context, string, string, string, DotNetComponent, *DotNetComponentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DotNetComponentsClientCreateOrUpdateResponse], error)` +- New function `*DotNetComponentsClient.BeginDelete(context.Context, string, string, string, *DotNetComponentsClientBeginDeleteOptions) (*runtime.Poller[DotNetComponentsClientDeleteResponse], error)` +- New function `*DotNetComponentsClient.Get(context.Context, string, string, string, *DotNetComponentsClientGetOptions) (DotNetComponentsClientGetResponse, error)` +- New function `*DotNetComponentsClient.NewListPager(string, string, *DotNetComponentsClientListOptions) *runtime.Pager[DotNetComponentsClientListResponse]` +- New function `*DotNetComponentsClient.BeginUpdate(context.Context, string, string, string, DotNetComponent, *DotNetComponentsClientBeginUpdateOptions) (*runtime.Poller[DotNetComponentsClientUpdateResponse], error)` +- New function `NewFunctionsExtensionClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FunctionsExtensionClient, error)` +- New function `*FunctionsExtensionClient.InvokeFunctionsHost(context.Context, string, string, string, string, *FunctionsExtensionClientInvokeFunctionsHostOptions) (FunctionsExtensionClientInvokeFunctionsHostResponse, error)` +- New function `*JavaComponentProperties.GetJavaComponentProperties() *JavaComponentProperties` +- New function `NewJavaComponentsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*JavaComponentsClient, error)` +- New function `*JavaComponentsClient.BeginCreateOrUpdate(context.Context, string, string, string, JavaComponent, *JavaComponentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[JavaComponentsClientCreateOrUpdateResponse], error)` +- New function `*JavaComponentsClient.BeginDelete(context.Context, string, string, string, *JavaComponentsClientBeginDeleteOptions) (*runtime.Poller[JavaComponentsClientDeleteResponse], error)` +- New function `*JavaComponentsClient.Get(context.Context, string, string, string, *JavaComponentsClientGetOptions) (JavaComponentsClientGetResponse, error)` +- New function `*JavaComponentsClient.NewListPager(string, string, *JavaComponentsClientListOptions) *runtime.Pager[JavaComponentsClientListResponse]` +- New function `*JavaComponentsClient.BeginUpdate(context.Context, string, string, string, JavaComponent, *JavaComponentsClientBeginUpdateOptions) (*runtime.Poller[JavaComponentsClientUpdateResponse], error)` +- New function `*JobsClient.BeginResume(context.Context, string, string, *JobsClientBeginResumeOptions) (*runtime.Poller[JobsClientResumeResponse], error)` +- New function `*JobsClient.BeginSuspend(context.Context, string, string, *JobsClientBeginSuspendOptions) (*runtime.Poller[JobsClientSuspendResponse], error)` +- New function `NewLogicAppsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LogicAppsClient, error)` +- New function `*LogicAppsClient.CreateOrUpdate(context.Context, string, string, string, LogicApp, *LogicAppsClientCreateOrUpdateOptions) (LogicAppsClientCreateOrUpdateResponse, error)` +- New function `*LogicAppsClient.Delete(context.Context, string, string, string, *LogicAppsClientDeleteOptions) (LogicAppsClientDeleteResponse, error)` +- New function `*LogicAppsClient.DeployWorkflowArtifacts(context.Context, string, string, string, *LogicAppsClientDeployWorkflowArtifactsOptions) (LogicAppsClientDeployWorkflowArtifactsResponse, error)` +- New function `*LogicAppsClient.Get(context.Context, string, string, string, *LogicAppsClientGetOptions) (LogicAppsClientGetResponse, error)` +- New function `*LogicAppsClient.GetWorkflow(context.Context, string, string, string, string, *LogicAppsClientGetWorkflowOptions) (LogicAppsClientGetWorkflowResponse, error)` +- New function `*LogicAppsClient.Invoke(context.Context, string, string, string, string, LogicAppsProxyMethod, *LogicAppsClientInvokeOptions) (LogicAppsClientInvokeResponse, error)` +- New function `*LogicAppsClient.ListWorkflowsConnections(context.Context, string, string, string, *LogicAppsClientListWorkflowsConnectionsOptions) (LogicAppsClientListWorkflowsConnectionsResponse, error)` +- New function `*LogicAppsClient.NewListWorkflowsPager(string, string, string, *LogicAppsClientListWorkflowsOptions) *runtime.Pager[LogicAppsClientListWorkflowsResponse]` +- New function `NewManagedEnvironmentPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedEnvironmentPrivateEndpointConnectionsClient, error)` +- New function `*ManagedEnvironmentPrivateEndpointConnectionsClient.BeginCreateOrUpdate(context.Context, string, string, string, PrivateEndpointConnection, *ManagedEnvironmentPrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse], error)` +- New function `*ManagedEnvironmentPrivateEndpointConnectionsClient.BeginDelete(context.Context, string, string, string, *ManagedEnvironmentPrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse], error)` +- New function `*ManagedEnvironmentPrivateEndpointConnectionsClient.Get(context.Context, string, string, string, *ManagedEnvironmentPrivateEndpointConnectionsClientGetOptions) (ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse, error)` +- New function `*ManagedEnvironmentPrivateEndpointConnectionsClient.NewListPager(string, string, *ManagedEnvironmentPrivateEndpointConnectionsClientListOptions) *runtime.Pager[ManagedEnvironmentPrivateEndpointConnectionsClientListResponse]` +- New function `NewManagedEnvironmentPrivateLinkResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedEnvironmentPrivateLinkResourcesClient, error)` +- New function `*ManagedEnvironmentPrivateLinkResourcesClient.NewListPager(string, string, *ManagedEnvironmentPrivateLinkResourcesClientListOptions) *runtime.Pager[ManagedEnvironmentPrivateLinkResourcesClientListResponse]` +- New function `*SpringBootAdminComponent.GetJavaComponentProperties() *JavaComponentProperties` +- New function `*SpringCloudConfigComponent.GetJavaComponentProperties() *JavaComponentProperties` +- New function `*SpringCloudEurekaComponent.GetJavaComponentProperties() *JavaComponentProperties` +- New function `*SpringCloudGatewayComponent.GetJavaComponentProperties() *JavaComponentProperties` +- New function `*NacosComponent.GetJavaComponentProperties() *JavaComponentProperties` +- New struct `AppInsightsConfiguration` +- New struct `AppResiliency` +- New struct `AppResiliencyCollection` +- New struct `AppResiliencyProperties` +- New struct `BuildCollection` +- New struct `BuildConfiguration` +- New struct `BuildProperties` +- New struct `BuildResource` +- New struct `BuildToken` +- New struct `BuilderCollection` +- New struct `BuilderProperties` +- New struct `BuilderResource` +- New struct `BuilderResourceUpdate` +- New struct `BuilderResourceUpdateProperties` +- New struct `CertificateKeyVaultProperties` +- New struct `CircuitBreakerPolicy` +- New struct `ContainerAppPropertiesPatchingConfiguration` +- New struct `ContainerAppsBuildCollection` +- New struct `ContainerAppsBuildConfiguration` +- New struct `ContainerAppsBuildProperties` +- New struct `ContainerAppsBuildResource` +- New struct `ContainerAppsPatchResource` +- New struct `ContainerExecutionStatus` +- New struct `ContainerRegistry` +- New struct `ContainerRegistryWithCustomImage` +- New struct `CustomContainerTemplate` +- New struct `DaprComponentResiliencyPoliciesCollection` +- New struct `DaprComponentResiliencyPolicy` +- New struct `DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration` +- New struct `DaprComponentResiliencyPolicyConfiguration` +- New struct `DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration` +- New struct `DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration` +- New struct `DaprComponentResiliencyPolicyProperties` +- New struct `DaprComponentResiliencyPolicyTimeoutPolicyConfiguration` +- New struct `DaprComponentServiceBinding` +- New struct `DaprServiceBindMetadata` +- New struct `DaprSubscription` +- New struct `DaprSubscriptionBulkSubscribeOptions` +- New struct `DaprSubscriptionProperties` +- New struct `DaprSubscriptionRouteRule` +- New struct `DaprSubscriptionRoutes` +- New struct `DaprSubscriptionsCollection` +- New struct `DataDogConfiguration` +- New struct `DestinationsConfiguration` +- New struct `DotNetComponent` +- New struct `DotNetComponentConfigurationProperty` +- New struct `DotNetComponentProperties` +- New struct `DotNetComponentServiceBind` +- New struct `DotNetComponentsCollection` +- New struct `DynamicPoolConfiguration` +- New struct `EnvironmentVariable` +- New struct `ErrorEntity` +- New struct `ExecutionStatus` +- New struct `HTTPConnectionPool` +- New struct `HTTPGet` +- New struct `HTTPRetryPolicy` +- New struct `HTTPRetryPolicyMatches` +- New struct `HTTPRetryPolicyRetryBackOff` +- New struct `Header` +- New struct `HeaderMatch` +- New struct `HeaderMatchMatch` +- New struct `IdentitySettings` +- New struct `JavaComponent` +- New struct `JavaComponentConfigurationProperty` +- New struct `JavaComponentIngress` +- New struct `JavaComponentPropertiesScale` +- New struct `JavaComponentServiceBind` +- New struct `JavaComponentsCollection` +- New struct `LoggerSetting` +- New struct `LogicApp` +- New struct `LogsConfiguration` +- New struct `MetricsConfiguration` +- New struct `NacosComponent` +- New struct `NfsAzureFileProperties` +- New struct `OpenTelemetryConfiguration` +- New struct `OtlpConfiguration` +- New struct `PatchCollection` +- New struct `PatchDetails` +- New struct `PatchDetailsNewLayer` +- New struct `PatchDetailsOldLayer` +- New struct `PatchProperties` +- New struct `PatchSkipConfig` +- New struct `PreBuildStep` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionProperties` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceListResult` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkServiceConnectionState` +- New struct `ReplicaExecutionStatus` +- New struct `Runtime` +- New struct `RuntimeDotnet` +- New struct `RuntimeJava` +- New struct `RuntimeJavaAgent` +- New struct `RuntimeJavaAgentLogging` +- New struct `ScaleConfiguration` +- New struct `ScgRoute` +- New struct `SessionContainer` +- New struct `SessionContainerResources` +- New struct `SessionIngress` +- New struct `SessionNetworkConfiguration` +- New struct `SessionPool` +- New struct `SessionPoolCollection` +- New struct `SessionPoolProperties` +- New struct `SessionPoolSecret` +- New struct `SessionPoolUpdatableProperties` +- New struct `SessionPoolUpdatablePropertiesProperties` +- New struct `SessionRegistryCredentials` +- New struct `SmbStorage` +- New struct `SpringBootAdminComponent` +- New struct `SpringCloudConfigComponent` +- New struct `SpringCloudEurekaComponent` +- New struct `SpringCloudGatewayComponent` +- New struct `TCPConnectionPool` +- New struct `TCPRetryPolicy` +- New struct `TimeoutPolicy` +- New struct `TracesConfiguration` +- New struct `WorkflowArtifacts` +- New struct `WorkflowEnvelope` +- New struct `WorkflowEnvelopeCollection` +- New struct `WorkflowEnvelopeProperties` +- New struct `WorkflowHealth` +- New field `ImageType` in struct `BaseContainer` +- New field `CertificateKeyVaultProperties`, `CertificateType` in struct `CertificateProperties` +- New field `IdentitySettings`, `Runtime` in struct `Configuration` +- New field `Smb` in struct `ConnectedEnvironmentStorageProperties` +- New field `ImageType` in struct `Container` +- New field `Kind` in struct `ContainerApp` +- New field `DeploymentErrors`, `PatchingConfiguration` in struct `ContainerAppProperties` +- New field `XMSGithubAuxiliary` in struct `ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions` +- New field `DeleteWorkflow`, `IgnoreWorkflowDeletionFailure`, `XMSGithubAuxiliary` in struct `ContainerAppsSourceControlsClientBeginDeleteOptions` +- New field `CertificateKeyVaultProperties` in struct `CustomDomainConfiguration` +- New field `Identity` in struct `CustomScaleRule` +- New field `ServiceComponentBind` in struct `DaprComponentProperties` +- New field `BuildEnvironmentVariables`, `DockerfilePath` in struct `GithubActionConfiguration` +- New field `Identity` in struct `HTTPScaleRule` +- New field `TargetPortHTTPScheme` in struct `Ingress` +- New field `ImageType` in struct `InitContainer` +- New field `ExtendedLocation` in struct `Job` +- New field `IdentitySettings` in struct `JobConfiguration` +- New field `DetailedStatus` in struct `JobExecutionProperties` +- New field `ExtendedLocation` in struct `JobPatchProperties` +- New field `RunningState` in struct `JobProperties` +- New field `Identity` in struct `JobScaleRule` +- New field `DynamicJSONColumns` in struct `LogAnalyticsConfiguration` +- New field `Identity` in struct `ManagedEnvironment` +- New field `AppInsightsConfiguration`, `OpenTelemetryConfiguration`, `PrivateEndpointConnections`, `PublicNetworkAccess` in struct `ManagedEnvironmentProperties` +- New field `NfsAzureFile` in struct `ManagedEnvironmentStorageProperties` +- New field `AccountName`, `Identity` in struct `QueueScaleRule` +- New field `DebugEndpoint` in struct `ReplicaContainer` +- New field `CooldownPeriod`, `PollingInterval` in struct `Scale` +- New field `ClientType`, `CustomizedKeys` in struct `ServiceBind` +- New field `Identity` in struct `TCPScaleRule` +- New field `EnableFips` in struct `WorkloadProfile` + + ## 3.0.0 (2024-08-23) ### Breaking Changes diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/README.md b/sdk/resourcemanager/appcontainers/armappcontainers/README.md index 0b7e3b420f..3da8922bbf 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/README.md +++ b/sdk/resourcemanager/appcontainers/armappcontainers/README.md @@ -57,7 +57,7 @@ clientFactory, err := armappcontainers.NewClientFactory(, cred, A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewAvailableWorkloadProfilesClient() +client := clientFactory.NewAppResiliencyClient() ``` ## Fakes diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client.go new file mode 100644 index 0000000000..8cf2a619e8 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client.go @@ -0,0 +1,384 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// AppResiliencyClient contains the methods for the AppResiliency group. +// Don't use this type directly, use NewAppResiliencyClient() instead. +type AppResiliencyClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAppResiliencyClient creates a new instance of AppResiliencyClient 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 NewAppResiliencyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AppResiliencyClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AppResiliencyClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - appName - Name of the Container App. +// - name - Name of the resiliency policy. +// - resiliencyEnvelope - The resiliency policy to create or update. +// - options - AppResiliencyClientCreateOrUpdateOptions contains the optional parameters for the AppResiliencyClient.CreateOrUpdate +// method. +func (client *AppResiliencyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, appName string, name string, resiliencyEnvelope AppResiliency, options *AppResiliencyClientCreateOrUpdateOptions) (AppResiliencyClientCreateOrUpdateResponse, error) { + var err error + const operationName = "AppResiliencyClient.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, appName, name, resiliencyEnvelope, options) + if err != nil { + return AppResiliencyClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AppResiliencyClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return AppResiliencyClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AppResiliencyClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, appName string, name string, resiliencyEnvelope AppResiliency, options *AppResiliencyClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if appName == "" { + return nil, errors.New("parameter appName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{appName}", url.PathEscape(appName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resiliencyEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AppResiliencyClient) createOrUpdateHandleResponse(resp *http.Response) (AppResiliencyClientCreateOrUpdateResponse, error) { + result := AppResiliencyClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AppResiliency); err != nil { + return AppResiliencyClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete container app resiliency policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - AppResiliencyClientDeleteOptions contains the optional parameters for the AppResiliencyClient.Delete method. +func (client *AppResiliencyClient) Delete(ctx context.Context, resourceGroupName string, appName string, name string, options *AppResiliencyClientDeleteOptions) (AppResiliencyClientDeleteResponse, error) { + var err error + const operationName = "AppResiliencyClient.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, appName, name, options) + if err != nil { + return AppResiliencyClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AppResiliencyClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AppResiliencyClientDeleteResponse{}, err + } + return AppResiliencyClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AppResiliencyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, appName string, name string, options *AppResiliencyClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if appName == "" { + return nil, errors.New("parameter appName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{appName}", url.PathEscape(appName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get container app resiliency policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - AppResiliencyClientGetOptions contains the optional parameters for the AppResiliencyClient.Get method. +func (client *AppResiliencyClient) Get(ctx context.Context, resourceGroupName string, appName string, name string, options *AppResiliencyClientGetOptions) (AppResiliencyClientGetResponse, error) { + var err error + const operationName = "AppResiliencyClient.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, appName, name, options) + if err != nil { + return AppResiliencyClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AppResiliencyClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AppResiliencyClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AppResiliencyClient) getCreateRequest(ctx context.Context, resourceGroupName string, appName string, name string, options *AppResiliencyClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if appName == "" { + return nil, errors.New("parameter appName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{appName}", url.PathEscape(appName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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 *AppResiliencyClient) getHandleResponse(resp *http.Response) (AppResiliencyClientGetResponse, error) { + result := AppResiliencyClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AppResiliency); err != nil { + return AppResiliencyClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List container app resiliency policies. +// +// Generated from API version 2024-08-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. +func (client *AppResiliencyClient) NewListPager(resourceGroupName string, appName string, options *AppResiliencyClientListOptions) *runtime.Pager[AppResiliencyClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AppResiliencyClientListResponse]{ + More: func(page AppResiliencyClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AppResiliencyClientListResponse) (AppResiliencyClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AppResiliencyClient.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, appName, options) + }, nil) + if err != nil { + return AppResiliencyClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *AppResiliencyClient) listCreateRequest(ctx context.Context, resourceGroupName string, appName string, options *AppResiliencyClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies" + 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 appName == "" { + return nil, errors.New("parameter appName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{appName}", url.PathEscape(appName)) + 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-08-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 *AppResiliencyClient) listHandleResponse(resp *http.Response) (AppResiliencyClientListResponse, error) { + result := AppResiliencyClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AppResiliencyCollection); err != nil { + return AppResiliencyClientListResponse{}, err + } + return result, nil +} + +// Update - Update container app resiliency policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - resiliencyEnvelope - The resiliency policy to update. +// - options - AppResiliencyClientUpdateOptions contains the optional parameters for the AppResiliencyClient.Update method. +func (client *AppResiliencyClient) Update(ctx context.Context, resourceGroupName string, appName string, name string, resiliencyEnvelope AppResiliency, options *AppResiliencyClientUpdateOptions) (AppResiliencyClientUpdateResponse, error) { + var err error + const operationName = "AppResiliencyClient.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, appName, name, resiliencyEnvelope, options) + if err != nil { + return AppResiliencyClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AppResiliencyClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AppResiliencyClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *AppResiliencyClient) updateCreateRequest(ctx context.Context, resourceGroupName string, appName string, name string, resiliencyEnvelope AppResiliency, options *AppResiliencyClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if appName == "" { + return nil, errors.New("parameter appName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{appName}", url.PathEscape(appName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resiliencyEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *AppResiliencyClient) updateHandleResponse(resp *http.Response) (AppResiliencyClientUpdateResponse, error) { + result := AppResiliencyClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AppResiliency); err != nil { + return AppResiliencyClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client_example_test.go new file mode 100644 index 0000000000..be83e60368 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/appresiliency_client_example_test.go @@ -0,0 +1,382 @@ +//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 f1ee22351a..e5f077e81b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md +++ b/sdk/resourcemanager/appcontainers/armappcontainers/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/readme.go.md +- 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 license-header: MICROSOFT_MIT_NO_VERSION -module-version: 3.0.0 -tag: package-2024-03 +module-version: 3.1.0-beta.1 +tag: package-preview-2024-08 ``` \ 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 21baadf8d6..f002bb1c0a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type AvailableWorkloadProfilesClient struct { } // NewAvailableWorkloadProfilesClient creates a new instance of AvailableWorkloadProfilesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewAvailableWorkloadProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableWorkloadProfilesClient, error) { @@ -45,7 +46,7 @@ func NewAvailableWorkloadProfilesClient(subscriptionID string, credential azcore // NewGetPager - Get all available workload profiles for a location. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-02-preview // - location - The name of Azure region. // - options - AvailableWorkloadProfilesClientGetOptions contains the optional parameters for the AvailableWorkloadProfilesClient.NewGetPager // method. @@ -88,7 +89,7 @@ func (client *AvailableWorkloadProfilesClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 9562197002..36dbfbea01 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/availableworkloadprofiles_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AvailableWorkloadProfiles_Get.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go index f37f0302a3..fb9d5607d5 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type BillingMetersClient struct { } // NewBillingMetersClient creates a new instance of BillingMetersClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewBillingMetersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BillingMetersClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-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) { @@ -87,7 +88,7 @@ func (client *BillingMetersClient) getCreateRequest(ctx context.Context, locatio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 3bcb32e790..7b05697674 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/billingmeters_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/BillingMeters_Get.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client.go new file mode 100644 index 0000000000..eb4ff14888 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// BuildAuthTokenClient contains the methods for the BuildAuthToken group. +// Don't use this type directly, use NewBuildAuthTokenClient() instead. +type BuildAuthTokenClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBuildAuthTokenClient creates a new instance of BuildAuthTokenClient 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 NewBuildAuthTokenClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BuildAuthTokenClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BuildAuthTokenClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - builderName - The name of the builder. +// - buildName - The name of a build. +// - options - BuildAuthTokenClientListOptions contains the optional parameters for the BuildAuthTokenClient.List method. +func (client *BuildAuthTokenClient) List(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *BuildAuthTokenClientListOptions) (BuildAuthTokenClientListResponse, error) { + var err error + const operationName = "BuildAuthTokenClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceGroupName, builderName, buildName, options) + if err != nil { + return BuildAuthTokenClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BuildAuthTokenClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BuildAuthTokenClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *BuildAuthTokenClient) listCreateRequest(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *BuildAuthTokenClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}/listAuthToken" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + if buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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 *BuildAuthTokenClient) listHandleResponse(resp *http.Response) (BuildAuthTokenClientListResponse, error) { + result := BuildAuthTokenClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BuildToken); err != nil { + return BuildAuthTokenClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client_example_test.go new file mode 100644 index 0000000000..4c00de57af --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/buildauthtoken_client_example_test.go @@ -0,0 +1,42 @@ +//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 new file mode 100644 index 0000000000..123a83291c --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/builders_client.go @@ -0,0 +1,461 @@ +//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" + "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" +) + +// BuildersClient contains the methods for the Builders group. +// Don't use this type directly, use NewBuildersClient() instead. +type BuildersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBuildersClient creates a new instance of BuildersClient 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 NewBuildersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BuildersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BuildersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a BuilderResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - builderName - The name of the builder. +// - builderEnvelope - Resource create parameters. +// - options - BuildersClientBeginCreateOrUpdateOptions contains the optional parameters for the BuildersClient.BeginCreateOrUpdate +// method. +func (client *BuildersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, builderName string, builderEnvelope BuilderResource, options *BuildersClientBeginCreateOrUpdateOptions) (*runtime.Poller[BuildersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, builderName, builderEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BuildersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BuildersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a BuilderResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + 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, builderName, builderEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BuildersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, builderName string, builderEnvelope BuilderResource, options *BuildersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, builderEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a BuilderResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +func (client *BuildersClient) BeginDelete(ctx context.Context, resourceGroupName string, builderName string, options *BuildersClientBeginDeleteOptions) (*runtime.Poller[BuildersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, builderName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BuildersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BuildersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a BuilderResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + 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, builderName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BuildersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, builderName string, options *BuildersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a BuilderResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +func (client *BuildersClient) Get(ctx context.Context, resourceGroupName string, builderName string, options *BuildersClientGetOptions) (BuildersClientGetResponse, error) { + var err error + const operationName = "BuildersClient.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, builderName, options) + if err != nil { + return BuildersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BuildersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BuildersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BuildersClient) getCreateRequest(ctx context.Context, resourceGroupName string, builderName string, options *BuildersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + 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-08-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 *BuildersClient) getHandleResponse(resp *http.Response) (BuildersClientGetResponse, error) { + result := BuildersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BuilderResource); err != nil { + return BuildersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List BuilderResource resources by resource group +// +// Generated from API version 2024-08-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. +func (client *BuildersClient) NewListByResourceGroupPager(resourceGroupName string, options *BuildersClientListByResourceGroupOptions) *runtime.Pager[BuildersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[BuildersClientListByResourceGroupResponse]{ + More: func(page BuildersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BuildersClientListByResourceGroupResponse) (BuildersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BuildersClient.NewListByResourceGroupPager") + 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.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return BuildersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *BuildersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *BuildersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *BuildersClient) listByResourceGroupHandleResponse(resp *http.Response) (BuildersClientListByResourceGroupResponse, error) { + result := BuildersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BuilderCollection); err != nil { + return BuildersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List BuilderResource resources by subscription ID +// +// Generated from API version 2024-08-02-preview +// - options - BuildersClientListBySubscriptionOptions contains the optional parameters for the BuildersClient.NewListBySubscriptionPager +// method. +func (client *BuildersClient) NewListBySubscriptionPager(options *BuildersClientListBySubscriptionOptions) *runtime.Pager[BuildersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[BuildersClientListBySubscriptionResponse]{ + More: func(page BuildersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BuildersClientListBySubscriptionResponse) (BuildersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BuildersClient.NewListBySubscriptionPager") + 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.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return BuildersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *BuildersClient) listBySubscriptionCreateRequest(ctx context.Context, options *BuildersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *BuildersClient) listBySubscriptionHandleResponse(resp *http.Response) (BuildersClientListBySubscriptionResponse, error) { + result := BuildersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BuilderCollection); err != nil { + return BuildersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a BuilderResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - BuildersClientBeginUpdateOptions contains the optional parameters for the BuildersClient.BeginUpdate method. +func (client *BuildersClient) BeginUpdate(ctx context.Context, resourceGroupName string, builderName string, builderEnvelope BuilderResourceUpdate, options *BuildersClientBeginUpdateOptions) (*runtime.Poller[BuildersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, builderName, builderEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BuildersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BuildersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a BuilderResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + 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, builderName, builderEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *BuildersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, builderName string, builderEnvelope BuilderResourceUpdate, options *BuildersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, builderEnvelope); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/builders_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/builders_client_example_test.go new file mode 100644 index 0000000000..4180c97a7d --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/builders_client_example_test.go @@ -0,0 +1,478 @@ +//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 new file mode 100644 index 0000000000..0464c3c4e3 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/builds_client.go @@ -0,0 +1,281 @@ +//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" + "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" +) + +// BuildsClient contains the methods for the Builds group. +// Don't use this type directly, use NewBuildsClient() instead. +type BuildsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBuildsClient creates a new instance of BuildsClient 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 NewBuildsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BuildsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BuildsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a BuildResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - buildEnvelope - Resource create or update parameters. +// - options - BuildsClientBeginCreateOrUpdateOptions contains the optional parameters for the BuildsClient.BeginCreateOrUpdate +// method. +func (client *BuildsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, builderName string, buildName string, buildEnvelope BuildResource, options *BuildsClientBeginCreateOrUpdateOptions) (*runtime.Poller[BuildsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, builderName, buildName, buildEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BuildsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BuildsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a BuildResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + 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, builderName, buildName, buildEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BuildsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, builderName string, buildName string, buildEnvelope BuildResource, options *BuildsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + if buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, buildEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a BuildResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - BuildsClientBeginDeleteOptions contains the optional parameters for the BuildsClient.BeginDelete method. +func (client *BuildsClient) BeginDelete(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *BuildsClientBeginDeleteOptions) (*runtime.Poller[BuildsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, builderName, buildName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BuildsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BuildsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a BuildResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + 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, builderName, buildName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BuildsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *BuildsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + if buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a BuildResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - BuildsClientGetOptions contains the optional parameters for the BuildsClient.Get method. +func (client *BuildsClient) Get(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *BuildsClientGetOptions) (BuildsClientGetResponse, error) { + var err error + const operationName = "BuildsClient.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, builderName, buildName, options) + if err != nil { + return BuildsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BuildsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BuildsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BuildsClient) getCreateRequest(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *BuildsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + if buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + 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-08-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 *BuildsClient) getHandleResponse(resp *http.Response) (BuildsClientGetResponse, error) { + result := BuildsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BuildResource); err != nil { + return BuildsClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/builds_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/builds_client_example_test.go new file mode 100644 index 0000000000..5ee64a7fe0 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/builds_client_example_test.go @@ -0,0 +1,303 @@ +//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 new file mode 100644 index 0000000000..c92bd55b84 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// BuildsByBuilderResourceClient contains the methods for the BuildsByBuilderResource group. +// Don't use this type directly, use NewBuildsByBuilderResourceClient() instead. +type BuildsByBuilderResourceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBuildsByBuilderResourceClient creates a new instance of BuildsByBuilderResourceClient 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 NewBuildsByBuilderResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BuildsByBuilderResourceClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BuildsByBuilderResourceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List BuildResource resources by BuilderResource +// +// Generated from API version 2024-08-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 +// method. +func (client *BuildsByBuilderResourceClient) NewListPager(resourceGroupName string, builderName string, options *BuildsByBuilderResourceClientListOptions) *runtime.Pager[BuildsByBuilderResourceClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BuildsByBuilderResourceClientListResponse]{ + More: func(page BuildsByBuilderResourceClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BuildsByBuilderResourceClientListResponse) (BuildsByBuilderResourceClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BuildsByBuilderResourceClient.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, builderName, options) + }, nil) + if err != nil { + return BuildsByBuilderResourceClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *BuildsByBuilderResourceClient) listCreateRequest(ctx context.Context, resourceGroupName string, builderName string, options *BuildsByBuilderResourceClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds" + 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 builderName == "" { + return nil, errors.New("parameter builderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{builderName}", url.PathEscape(builderName)) + 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-08-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 *BuildsByBuilderResourceClient) listHandleResponse(resp *http.Response) (BuildsByBuilderResourceClientListResponse, error) { + result := BuildsByBuilderResourceClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BuildCollection); err != nil { + return BuildsByBuilderResourceClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client_example_test.go new file mode 100644 index 0000000000..0d72d74d91 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/buildsbybuilderresource_client_example_test.go @@ -0,0 +1,174 @@ +//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 ce11970842..6e61666661 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type CertificatesClient struct { } // NewCertificatesClient creates a new instance of CertificatesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CertificatesClient, error) { @@ -46,7 +47,7 @@ func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or Update a Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -98,7 +99,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.CertificateEnvelope != nil { @@ -122,7 +123,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-03-01 +// Generated from API version 2024-08-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. @@ -172,7 +173,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +182,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-03-01 +// Generated from API version 2024-08-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. @@ -232,7 +233,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +250,7 @@ func (client *CertificatesClient) getHandleResponse(resp *http.Response) (Certif // NewListPager - Get the Certificates in a given managed environment. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -296,7 +297,7 @@ func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -314,7 +315,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-03-01 +// Generated from API version 2024-08-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. @@ -366,7 +367,7 @@ func (client *CertificatesClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index fd2b3c3b36..e7271d320c 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/certificates_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_ListByManagedEnvironment.json +// 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 { @@ -45,9 +45,10 @@ func ExampleCertificatesClient_NewListPager() { // { // Name: to.Ptr("certificate-firendly-name"), // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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"), @@ -62,9 +63,10 @@ func ExampleCertificatesClient_NewListPager() { // { // Name: to.Ptr("certificate-firendly-name"), // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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"), @@ -80,7 +82,7 @@ func ExampleCertificatesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_Get.json +// 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 { @@ -101,9 +103,10 @@ func ExampleCertificatesClient_Get() { // res.Certificate = armappcontainers.Certificate{ // Name: to.Ptr("certificate-firendly-name"), // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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"), @@ -117,8 +120,8 @@ func ExampleCertificatesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_CreateOrUpdate.json -func ExampleCertificatesClient_CreateOrUpdate() { +// 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) @@ -131,8 +134,9 @@ func ExampleCertificatesClient_CreateOrUpdate() { res, err := clientFactory.NewCertificatesClient().CreateOrUpdate(ctx, "examplerg", "testcontainerenv", "certificate-firendly-name", &armappcontainers.CertificatesClientCreateOrUpdateOptions{CertificateEnvelope: &armappcontainers.Certificate{ Location: to.Ptr("East US"), Properties: &armappcontainers.CertificateProperties{ - Password: to.Ptr("private key password"), - Value: []byte("Y2VydA=="), + CertificateType: to.Ptr(armappcontainers.CertificateTypeImagePullTrustedCA), + Password: to.Ptr("private key password"), + Value: []byte("Y2VydA=="), }, }, }) @@ -144,9 +148,10 @@ func ExampleCertificatesClient_CreateOrUpdate() { // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.Certificate = armappcontainers.Certificate{ // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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"), @@ -160,7 +165,58 @@ func ExampleCertificatesClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_Delete.json +// 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 { @@ -177,7 +233,7 @@ func ExampleCertificatesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_Patch.json +// 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 { @@ -202,13 +258,14 @@ func ExampleCertificatesClient_Update() { // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.Certificate = armappcontainers.Certificate{ // Type: to.Ptr("Microsoft.App/ManagedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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"), diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go b/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go index 8ae8900328..b7ffd5d49e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/client_factory.go @@ -22,7 +22,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -36,6 +36,14 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewAppResiliencyClient creates a new instance of AppResiliencyClient. +func (c *ClientFactory) NewAppResiliencyClient() *AppResiliencyClient { + return &AppResiliencyClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewAvailableWorkloadProfilesClient creates a new instance of AvailableWorkloadProfilesClient. func (c *ClientFactory) NewAvailableWorkloadProfilesClient() *AvailableWorkloadProfilesClient { return &AvailableWorkloadProfilesClient{ @@ -52,6 +60,38 @@ func (c *ClientFactory) NewBillingMetersClient() *BillingMetersClient { } } +// NewBuildAuthTokenClient creates a new instance of BuildAuthTokenClient. +func (c *ClientFactory) NewBuildAuthTokenClient() *BuildAuthTokenClient { + return &BuildAuthTokenClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewBuildersClient creates a new instance of BuildersClient. +func (c *ClientFactory) NewBuildersClient() *BuildersClient { + return &BuildersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewBuildsByBuilderResourceClient creates a new instance of BuildsByBuilderResourceClient. +func (c *ClientFactory) NewBuildsByBuilderResourceClient() *BuildsByBuilderResourceClient { + return &BuildsByBuilderResourceClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewBuildsClient creates a new instance of BuildsClient. +func (c *ClientFactory) NewBuildsClient() *BuildsClient { + return &BuildsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewCertificatesClient creates a new instance of CertificatesClient. func (c *ClientFactory) NewCertificatesClient() *CertificatesClient { return &CertificatesClient{ @@ -108,6 +148,22 @@ func (c *ClientFactory) NewContainerAppsAuthConfigsClient() *ContainerAppsAuthCo } } +// NewContainerAppsBuildsByContainerAppClient creates a new instance of ContainerAppsBuildsByContainerAppClient. +func (c *ClientFactory) NewContainerAppsBuildsByContainerAppClient() *ContainerAppsBuildsByContainerAppClient { + return &ContainerAppsBuildsByContainerAppClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewContainerAppsBuildsClient creates a new instance of ContainerAppsBuildsClient. +func (c *ClientFactory) NewContainerAppsBuildsClient() *ContainerAppsBuildsClient { + return &ContainerAppsBuildsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewContainerAppsClient creates a new instance of ContainerAppsClient. func (c *ClientFactory) NewContainerAppsClient() *ContainerAppsClient { return &ContainerAppsClient{ @@ -124,6 +180,14 @@ func (c *ClientFactory) NewContainerAppsDiagnosticsClient() *ContainerAppsDiagno } } +// NewContainerAppsPatchesClient creates a new instance of ContainerAppsPatchesClient. +func (c *ClientFactory) NewContainerAppsPatchesClient() *ContainerAppsPatchesClient { + return &ContainerAppsPatchesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewContainerAppsRevisionReplicasClient creates a new instance of ContainerAppsRevisionReplicasClient. func (c *ClientFactory) NewContainerAppsRevisionReplicasClient() *ContainerAppsRevisionReplicasClient { return &ContainerAppsRevisionReplicasClient{ @@ -140,6 +204,14 @@ func (c *ClientFactory) NewContainerAppsRevisionsClient() *ContainerAppsRevision } } +// NewContainerAppsSessionPoolsClient creates a new instance of ContainerAppsSessionPoolsClient. +func (c *ClientFactory) NewContainerAppsSessionPoolsClient() *ContainerAppsSessionPoolsClient { + return &ContainerAppsSessionPoolsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewContainerAppsSourceControlsClient creates a new instance of ContainerAppsSourceControlsClient. func (c *ClientFactory) NewContainerAppsSourceControlsClient() *ContainerAppsSourceControlsClient { return &ContainerAppsSourceControlsClient{ @@ -148,6 +220,14 @@ func (c *ClientFactory) NewContainerAppsSourceControlsClient() *ContainerAppsSou } } +// NewDaprComponentResiliencyPoliciesClient creates a new instance of DaprComponentResiliencyPoliciesClient. +func (c *ClientFactory) NewDaprComponentResiliencyPoliciesClient() *DaprComponentResiliencyPoliciesClient { + return &DaprComponentResiliencyPoliciesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewDaprComponentsClient creates a new instance of DaprComponentsClient. func (c *ClientFactory) NewDaprComponentsClient() *DaprComponentsClient { return &DaprComponentsClient{ @@ -156,6 +236,38 @@ func (c *ClientFactory) NewDaprComponentsClient() *DaprComponentsClient { } } +// NewDaprSubscriptionsClient creates a new instance of DaprSubscriptionsClient. +func (c *ClientFactory) NewDaprSubscriptionsClient() *DaprSubscriptionsClient { + return &DaprSubscriptionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDotNetComponentsClient creates a new instance of DotNetComponentsClient. +func (c *ClientFactory) NewDotNetComponentsClient() *DotNetComponentsClient { + return &DotNetComponentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFunctionsExtensionClient creates a new instance of FunctionsExtensionClient. +func (c *ClientFactory) NewFunctionsExtensionClient() *FunctionsExtensionClient { + return &FunctionsExtensionClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewJavaComponentsClient creates a new instance of JavaComponentsClient. +func (c *ClientFactory) NewJavaComponentsClient() *JavaComponentsClient { + return &JavaComponentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewJobsClient creates a new instance of JobsClient. func (c *ClientFactory) NewJobsClient() *JobsClient { return &JobsClient{ @@ -172,6 +284,14 @@ func (c *ClientFactory) NewJobsExecutionsClient() *JobsExecutionsClient { } } +// NewLogicAppsClient creates a new instance of LogicAppsClient. +func (c *ClientFactory) NewLogicAppsClient() *LogicAppsClient { + return &LogicAppsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewManagedCertificatesClient creates a new instance of ManagedCertificatesClient. func (c *ClientFactory) NewManagedCertificatesClient() *ManagedCertificatesClient { return &ManagedCertificatesClient{ @@ -188,6 +308,22 @@ func (c *ClientFactory) NewManagedEnvironmentDiagnosticsClient() *ManagedEnviron } } +// NewManagedEnvironmentPrivateEndpointConnectionsClient creates a new instance of ManagedEnvironmentPrivateEndpointConnectionsClient. +func (c *ClientFactory) NewManagedEnvironmentPrivateEndpointConnectionsClient() *ManagedEnvironmentPrivateEndpointConnectionsClient { + return &ManagedEnvironmentPrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewManagedEnvironmentPrivateLinkResourcesClient creates a new instance of ManagedEnvironmentPrivateLinkResourcesClient. +func (c *ClientFactory) NewManagedEnvironmentPrivateLinkResourcesClient() *ManagedEnvironmentPrivateLinkResourcesClient { + return &ManagedEnvironmentPrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewManagedEnvironmentUsagesClient creates a new instance of ManagedEnvironmentUsagesClient. func (c *ClientFactory) NewManagedEnvironmentUsagesClient() *ManagedEnvironmentUsagesClient { return &ManagedEnvironmentUsagesClient{ diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go index 6312b07cc6..70a8823f70 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ConnectedEnvironmentsClient struct { } // NewConnectedEnvironmentsClient creates a new instance of ConnectedEnvironmentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewConnectedEnvironmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-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. @@ -94,7 +95,7 @@ func (client *ConnectedEnvironmentsClient) checkNameAvailabilityCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, checkNameAvailabilityRequest); err != nil { @@ -115,7 +116,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-03-01 +// Generated from API version 2024-08-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. @@ -142,7 +143,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-03-01 +// Generated from API version 2024-08-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" @@ -184,7 +185,7 @@ func (client *ConnectedEnvironmentsClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, environmentEnvelope); err != nil { @@ -196,7 +197,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-03-01 +// Generated from API version 2024-08-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 @@ -222,7 +223,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-03-01 +// Generated from API version 2024-08-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" @@ -264,7 +265,7 @@ func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -273,7 +274,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-03-01 +// Generated from API version 2024-08-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 @@ -320,7 +321,7 @@ func (client *ConnectedEnvironmentsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -337,7 +338,7 @@ func (client *ConnectedEnvironmentsClient) getHandleResponse(resp *http.Response // NewListByResourceGroupPager - Get all connectedEnvironments in a resource group. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -380,7 +381,7 @@ func (client *ConnectedEnvironmentsClient) listByResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -397,7 +398,7 @@ func (client *ConnectedEnvironmentsClient) listByResourceGroupHandleResponse(res // NewListBySubscriptionPager - Get all connectedEnvironments for a subscription. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-02-preview // - options - ConnectedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ConnectedEnvironmentsClient.NewListBySubscriptionPager // method. func (client *ConnectedEnvironmentsClient) NewListBySubscriptionPager(options *ConnectedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ConnectedEnvironmentsClientListBySubscriptionResponse] { @@ -435,7 +436,7 @@ func (client *ConnectedEnvironmentsClient) listBySubscriptionCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -453,7 +454,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-03-01 +// Generated from API version 2024-08-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 @@ -500,7 +501,7 @@ func (client *ConnectedEnvironmentsClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 86c3798da5..55f04b1cb8 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironments_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_ListBySubscription.json +// 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 { @@ -86,7 +86,7 @@ func ExampleConnectedEnvironmentsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_ListByResourceGroup.json +// 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 { @@ -162,7 +162,7 @@ func ExampleConnectedEnvironmentsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Get.json +// 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 { @@ -206,7 +206,7 @@ func ExampleConnectedEnvironmentsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_CreateOrUpdate.json +// 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 { @@ -265,7 +265,7 @@ func ExampleConnectedEnvironmentsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Delete.json +// 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 { @@ -286,7 +286,7 @@ func ExampleConnectedEnvironmentsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Patch.json +// 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 { @@ -328,7 +328,7 @@ func ExampleConnectedEnvironmentsClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go index 2592a559f5..14710f66f6 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ConnectedEnvironmentsCertificatesClient struct { } // NewConnectedEnvironmentsCertificatesClient creates a new instance of ConnectedEnvironmentsCertificatesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewConnectedEnvironmentsCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsCertificatesClient, error) { @@ -46,7 +47,7 @@ func NewConnectedEnvironmentsCertificatesClient(subscriptionID string, credentia // CreateOrUpdate - Create or Update a Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -98,7 +99,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.CertificateEnvelope != nil { @@ -122,7 +123,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) createOrUpdateHandleRespo // Delete - Deletes the specified Certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -173,7 +174,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) deleteCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +183,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-03-01 +// Generated from API version 2024-08-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. @@ -234,7 +235,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +252,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) getHandleResponse(resp *h // NewListPager - Get the Certificates in a given connected environment. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -299,7 +300,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) listCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -317,7 +318,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) listHandleResponse(resp * // 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-03-01 +// Generated from API version 2024-08-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. @@ -370,7 +371,7 @@ func (client *ConnectedEnvironmentsCertificatesClient) updateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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/connectedenvironmentscertificates_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client_example_test.go index 8d26f7df49..295aa2494e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentscertificates_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +// 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 { @@ -45,7 +45,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_NewListPager() { // { // Name: to.Ptr("certificate-firendly-name"), // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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}()), @@ -62,7 +62,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_NewListPager() { // { // Name: to.Ptr("certificate-firendly-name"), // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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}()), @@ -80,7 +80,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_Get.json +// 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 { @@ -101,7 +101,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_Get() { // res.Certificate = armappcontainers.Certificate{ // Name: to.Ptr("certificate-firendly-name"), // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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}()), @@ -117,7 +117,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +// 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 { @@ -144,7 +144,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_CreateOrUpdate() { // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.Certificate = armappcontainers.Certificate{ // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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}()), @@ -160,7 +160,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_Delete.json +// 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 { @@ -177,7 +177,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_Patch.json +// 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 { @@ -202,7 +202,7 @@ func ExampleConnectedEnvironmentsCertificatesClient_Update() { // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.Certificate = armappcontainers.Certificate{ // Type: to.Ptr("Microsoft.App/ConnectedEnvironments/Certificates"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/connectedEnvironments/testcontainerenv/certificate-firendly-name"), + // 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"), diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go index 2ef2184ea7..85be724980 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ConnectedEnvironmentsDaprComponentsClient struct { } // NewConnectedEnvironmentsDaprComponentsClient creates a new instance of ConnectedEnvironmentsDaprComponentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewConnectedEnvironmentsDaprComponentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsDaprComponentsClient, error) { @@ -46,7 +47,7 @@ func NewConnectedEnvironmentsDaprComponentsClient(subscriptionID string, credent // 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-03-01 +// Generated from API version 2024-08-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. @@ -99,7 +100,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, daprComponentEnvelope); err != nil { @@ -120,7 +121,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) createOrUpdateHandleRes // Delete - Delete a Dapr Component from a connected environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -171,7 +172,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +181,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-03-01 +// Generated from API version 2024-08-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. @@ -232,7 +233,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) getCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +250,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) getHandleResponse(resp // NewListPager - Get the Dapr Components for a connected environment. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -297,7 +298,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) listCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -315,7 +316,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-03-01 +// Generated from API version 2024-08-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. @@ -367,7 +368,7 @@ func (client *ConnectedEnvironmentsDaprComponentsClient) listSecretsCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index c0760b7c8a..1730f7a921 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsdaprcomponents_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_List.json +// 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 { @@ -74,6 +74,15 @@ func ExampleConnectedEnvironmentsDaprComponentsClient_NewListPager() { // { // 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"), // }, // }}, @@ -81,7 +90,7 @@ func ExampleConnectedEnvironmentsDaprComponentsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_Get.json +// 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 { @@ -131,12 +140,21 @@ func ExampleConnectedEnvironmentsDaprComponentsClient_Get() { // { // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +// 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 { @@ -177,6 +195,15 @@ func ExampleConnectedEnvironmentsDaprComponentsClient_CreateOrUpdate() { 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) @@ -218,12 +245,21 @@ func ExampleConnectedEnvironmentsDaprComponentsClient_CreateOrUpdate() { // { // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_Delete.json +// 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 { @@ -240,7 +276,7 @@ func ExampleConnectedEnvironmentsDaprComponentsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go index 8e4441a0a2..d1c9c1376e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ConnectedEnvironmentsStoragesClient struct { } // NewConnectedEnvironmentsStoragesClient creates a new instance of ConnectedEnvironmentsStoragesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewConnectedEnvironmentsStoragesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedEnvironmentsStoragesClient, error) { @@ -46,7 +47,7 @@ func NewConnectedEnvironmentsStoragesClient(subscriptionID string, credential az // CreateOrUpdate - Create or update storage for a connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - connectedEnvironmentName - Name of the Environment. // - storageName - Name of the storage. @@ -99,7 +100,7 @@ func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, storageEnvelope); err != nil { @@ -120,7 +121,7 @@ func (client *ConnectedEnvironmentsStoragesClient) createOrUpdateHandleResponse( // Delete - Delete storage for a connectedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - connectedEnvironmentName - Name of the Environment. // - storageName - Name of the storage. @@ -171,7 +172,7 @@ func (client *ConnectedEnvironmentsStoragesClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +181,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-03-01 +// Generated from API version 2024-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - connectedEnvironmentName - Name of the Environment. // - storageName - Name of the storage. @@ -232,7 +233,7 @@ func (client *ConnectedEnvironmentsStoragesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +251,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-03-01 +// Generated from API version 2024-08-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 @@ -297,7 +298,7 @@ func (client *ConnectedEnvironmentsStoragesClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 431fcd252e..ef1c8a2a36 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/connectedenvironmentsstorages_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_List.json +// 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 { @@ -53,7 +53,7 @@ func ExampleConnectedEnvironmentsStoragesClient_List() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_Get.json +// 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 { @@ -85,7 +85,7 @@ func ExampleConnectedEnvironmentsStoragesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +// 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 { @@ -126,7 +126,7 @@ func ExampleConnectedEnvironmentsStoragesClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_Delete.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/constants.go b/sdk/resourcemanager/appcontainers/armappcontainers/constants.go index b1cf280865..93c1912a91 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.0.0" + moduleVersion = "v3.1.0-beta.1" ) // AccessMode - Access mode for storage @@ -127,6 +127,76 @@ func PossibleBindingTypeValues() []BindingType { } } +// BuildProvisioningState - Resource instance provisioning state. +type BuildProvisioningState string + +const ( + BuildProvisioningStateCanceled BuildProvisioningState = "Canceled" + BuildProvisioningStateCreating BuildProvisioningState = "Creating" + BuildProvisioningStateDeleting BuildProvisioningState = "Deleting" + BuildProvisioningStateFailed BuildProvisioningState = "Failed" + BuildProvisioningStateSucceeded BuildProvisioningState = "Succeeded" + BuildProvisioningStateUpdating BuildProvisioningState = "Updating" +) + +// PossibleBuildProvisioningStateValues returns the possible values for the BuildProvisioningState const type. +func PossibleBuildProvisioningStateValues() []BuildProvisioningState { + return []BuildProvisioningState{ + BuildProvisioningStateCanceled, + BuildProvisioningStateCreating, + BuildProvisioningStateDeleting, + BuildProvisioningStateFailed, + BuildProvisioningStateSucceeded, + BuildProvisioningStateUpdating, + } +} + +// BuildStatus - Status of the build once it has been provisioned. +type BuildStatus string + +const ( + BuildStatusCanceled BuildStatus = "Canceled" + BuildStatusFailed BuildStatus = "Failed" + BuildStatusInProgress BuildStatus = "InProgress" + BuildStatusNotStarted BuildStatus = "NotStarted" + BuildStatusSucceeded BuildStatus = "Succeeded" +) + +// PossibleBuildStatusValues returns the possible values for the BuildStatus const type. +func PossibleBuildStatusValues() []BuildStatus { + return []BuildStatus{ + BuildStatusCanceled, + BuildStatusFailed, + BuildStatusInProgress, + BuildStatusNotStarted, + BuildStatusSucceeded, + } +} + +// BuilderProvisioningState - Resource instance provisioning state. +type BuilderProvisioningState string + +const ( + BuilderProvisioningStateCanceled BuilderProvisioningState = "Canceled" + BuilderProvisioningStateCreating BuilderProvisioningState = "Creating" + BuilderProvisioningStateDeleting BuilderProvisioningState = "Deleting" + BuilderProvisioningStateFailed BuilderProvisioningState = "Failed" + BuilderProvisioningStateSucceeded BuilderProvisioningState = "Succeeded" + BuilderProvisioningStateUpdating BuilderProvisioningState = "Updating" +) + +// PossibleBuilderProvisioningStateValues returns the possible values for the BuilderProvisioningState const type. +func PossibleBuilderProvisioningStateValues() []BuilderProvisioningState { + return []BuilderProvisioningState{ + BuilderProvisioningStateCanceled, + BuilderProvisioningStateCreating, + BuilderProvisioningStateDeleting, + BuilderProvisioningStateFailed, + BuilderProvisioningStateSucceeded, + BuilderProvisioningStateUpdating, + } +} + // CertificateProvisioningState - Provisioning state of the certificate. type CertificateProvisioningState string @@ -149,6 +219,22 @@ func PossibleCertificateProvisioningStateValues() []CertificateProvisioningState } } +// CertificateType - The type of the certificate. Allowed values are ServerSSLCertificate and ImagePullTrustedCA +type CertificateType string + +const ( + CertificateTypeImagePullTrustedCA CertificateType = "ImagePullTrustedCA" + CertificateTypeServerSSLCertificate CertificateType = "ServerSSLCertificate" +) + +// PossibleCertificateTypeValues returns the possible values for the CertificateType const type. +func PossibleCertificateTypeValues() []CertificateType { + return []CertificateType{ + CertificateTypeImagePullTrustedCA, + CertificateTypeServerSSLCertificate, + } +} + // CheckNameAvailabilityReason - The reason why the given name is not available. type CheckNameAvailabilityReason string @@ -251,6 +337,22 @@ func PossibleContainerAppReplicaRunningStateValues() []ContainerAppReplicaRunnin } } +// ContainerType - The container type of the sessions. +type ContainerType string + +const ( + ContainerTypeCustomContainer ContainerType = "CustomContainer" + ContainerTypePythonLTS ContainerType = "PythonLTS" +) + +// PossibleContainerTypeValues returns the possible values for the ContainerType const type. +func PossibleContainerTypeValues() []ContainerType { + return []ContainerType{ + ContainerTypeCustomContainer, + ContainerTypePythonLTS, + } +} + // CookieExpirationConvention - The convention used when determining the session cookie's expiration. type CookieExpirationConvention string @@ -305,6 +407,60 @@ func PossibleDNSVerificationTestResultValues() []DNSVerificationTestResult { } } +// DetectionStatus - The status of the patch detection. +type DetectionStatus string + +const ( + DetectionStatusFailed DetectionStatus = "Failed" + DetectionStatusRegistryLoginFailed DetectionStatus = "RegistryLoginFailed" + DetectionStatusSucceeded DetectionStatus = "Succeeded" +) + +// PossibleDetectionStatusValues returns the possible values for the DetectionStatus const type. +func PossibleDetectionStatusValues() []DetectionStatus { + return []DetectionStatus{ + DetectionStatusFailed, + DetectionStatusRegistryLoginFailed, + DetectionStatusSucceeded, + } +} + +// DotNetComponentProvisioningState - Provisioning state of the .NET Component. +type DotNetComponentProvisioningState string + +const ( + DotNetComponentProvisioningStateCanceled DotNetComponentProvisioningState = "Canceled" + DotNetComponentProvisioningStateDeleting DotNetComponentProvisioningState = "Deleting" + DotNetComponentProvisioningStateFailed DotNetComponentProvisioningState = "Failed" + DotNetComponentProvisioningStateInProgress DotNetComponentProvisioningState = "InProgress" + DotNetComponentProvisioningStateSucceeded DotNetComponentProvisioningState = "Succeeded" +) + +// PossibleDotNetComponentProvisioningStateValues returns the possible values for the DotNetComponentProvisioningState const type. +func PossibleDotNetComponentProvisioningStateValues() []DotNetComponentProvisioningState { + return []DotNetComponentProvisioningState{ + DotNetComponentProvisioningStateCanceled, + DotNetComponentProvisioningStateDeleting, + DotNetComponentProvisioningStateFailed, + DotNetComponentProvisioningStateInProgress, + DotNetComponentProvisioningStateSucceeded, + } +} + +// DotNetComponentType - Type of the .NET Component. +type DotNetComponentType string + +const ( + DotNetComponentTypeAspireDashboard DotNetComponentType = "AspireDashboard" +) + +// PossibleDotNetComponentTypeValues returns the possible values for the DotNetComponentType const type. +func PossibleDotNetComponentTypeValues() []DotNetComponentType { + return []DotNetComponentType{ + DotNetComponentTypeAspireDashboard, + } +} + // EnvironmentProvisioningState - Provisioning state of the Environment. type EnvironmentProvisioningState string @@ -337,6 +493,20 @@ func PossibleEnvironmentProvisioningStateValues() []EnvironmentProvisioningState } } +// ExecutionType - The execution type of the session pool. +type ExecutionType string + +const ( + ExecutionTypeTimed ExecutionType = "Timed" +) + +// PossibleExecutionTypeValues returns the possible values for the ExecutionType const type. +func PossibleExecutionTypeValues() []ExecutionType { + return []ExecutionType{ + ExecutionTypeTimed, + } +} + // ExtendedLocationTypes - The type of extendedLocation. type ExtendedLocationTypes string @@ -369,6 +539,44 @@ func PossibleForwardProxyConventionValues() []ForwardProxyConvention { } } +// IdentitySettingsLifeCycle - Use to select the lifecycle stages of a Container App during which the Managed Identity should +// be available. +type IdentitySettingsLifeCycle string + +const ( + IdentitySettingsLifeCycleAll IdentitySettingsLifeCycle = "All" + IdentitySettingsLifeCycleInit IdentitySettingsLifeCycle = "Init" + IdentitySettingsLifeCycleMain IdentitySettingsLifeCycle = "Main" + IdentitySettingsLifeCycleNone IdentitySettingsLifeCycle = "None" +) + +// PossibleIdentitySettingsLifeCycleValues returns the possible values for the IdentitySettingsLifeCycle const type. +func PossibleIdentitySettingsLifeCycleValues() []IdentitySettingsLifeCycle { + return []IdentitySettingsLifeCycle{ + IdentitySettingsLifeCycleAll, + IdentitySettingsLifeCycleInit, + IdentitySettingsLifeCycleMain, + IdentitySettingsLifeCycleNone, + } +} + +// ImageType - The type of the image. Set to CloudBuild to let the system manages the image, where user will not be able to +// update image through image field. Set to ContainerImage for user provided image. +type ImageType string + +const ( + ImageTypeCloudBuild ImageType = "CloudBuild" + ImageTypeContainerImage ImageType = "ContainerImage" +) + +// PossibleImageTypeValues returns the possible values for the ImageType const type. +func PossibleImageTypeValues() []ImageType { + return []ImageType{ + ImageTypeCloudBuild, + ImageTypeContainerImage, + } +} + // IngressClientCertificateMode - Client certificate mode for mTLS authentication. Ignore indicates server drops client certificate // on forwarding. Accept indicates server forwards client certificate but does not require a client // certificate. Require indicates server requires a client certificate. @@ -389,6 +597,22 @@ func PossibleIngressClientCertificateModeValues() []IngressClientCertificateMode } } +// IngressTargetPortHTTPScheme - Whether an http app listens on http or https +type IngressTargetPortHTTPScheme string + +const ( + IngressTargetPortHTTPSchemeHTTP IngressTargetPortHTTPScheme = "http" + IngressTargetPortHTTPSchemeHTTPS IngressTargetPortHTTPScheme = "https" +) + +// PossibleIngressTargetPortHTTPSchemeValues returns the possible values for the IngressTargetPortHTTPScheme const type. +func PossibleIngressTargetPortHTTPSchemeValues() []IngressTargetPortHTTPScheme { + return []IngressTargetPortHTTPScheme{ + IngressTargetPortHTTPSchemeHTTP, + IngressTargetPortHTTPSchemeHTTPS, + } +} + // IngressTransportMethod - Ingress transport protocol type IngressTransportMethod string @@ -409,6 +633,50 @@ func PossibleIngressTransportMethodValues() []IngressTransportMethod { } } +// JavaComponentProvisioningState - Provisioning state of the Java Component. +type JavaComponentProvisioningState string + +const ( + JavaComponentProvisioningStateCanceled JavaComponentProvisioningState = "Canceled" + JavaComponentProvisioningStateDeleting JavaComponentProvisioningState = "Deleting" + JavaComponentProvisioningStateFailed JavaComponentProvisioningState = "Failed" + JavaComponentProvisioningStateInProgress JavaComponentProvisioningState = "InProgress" + JavaComponentProvisioningStateSucceeded JavaComponentProvisioningState = "Succeeded" +) + +// PossibleJavaComponentProvisioningStateValues returns the possible values for the JavaComponentProvisioningState const type. +func PossibleJavaComponentProvisioningStateValues() []JavaComponentProvisioningState { + return []JavaComponentProvisioningState{ + JavaComponentProvisioningStateCanceled, + JavaComponentProvisioningStateDeleting, + JavaComponentProvisioningStateFailed, + JavaComponentProvisioningStateInProgress, + JavaComponentProvisioningStateSucceeded, + } +} + +// JavaComponentType - Type of the Java Component. +type JavaComponentType string + +const ( + JavaComponentTypeNacos JavaComponentType = "Nacos" + JavaComponentTypeSpringBootAdmin JavaComponentType = "SpringBootAdmin" + JavaComponentTypeSpringCloudConfig JavaComponentType = "SpringCloudConfig" + JavaComponentTypeSpringCloudEureka JavaComponentType = "SpringCloudEureka" + JavaComponentTypeSpringCloudGateway JavaComponentType = "SpringCloudGateway" +) + +// PossibleJavaComponentTypeValues returns the possible values for the JavaComponentType const type. +func PossibleJavaComponentTypeValues() []JavaComponentType { + return []JavaComponentType{ + JavaComponentTypeNacos, + JavaComponentTypeSpringBootAdmin, + JavaComponentTypeSpringCloudConfig, + JavaComponentTypeSpringCloudEureka, + JavaComponentTypeSpringCloudGateway, + } +} + // JobExecutionRunningState - Current running State of the job type JobExecutionRunningState string @@ -457,6 +725,64 @@ func PossibleJobProvisioningStateValues() []JobProvisioningState { } } +// JobRunningState - Current running state of the job +type JobRunningState string + +const ( + JobRunningStateProgressing JobRunningState = "Progressing" + JobRunningStateReady JobRunningState = "Ready" + JobRunningStateSuspended JobRunningState = "Suspended" +) + +// PossibleJobRunningStateValues returns the possible values for the JobRunningState const type. +func PossibleJobRunningStateValues() []JobRunningState { + return []JobRunningState{ + JobRunningStateProgressing, + JobRunningStateReady, + JobRunningStateSuspended, + } +} + +// Kind - Metadata used to render different experiences for resources of the same type; e.g. WorkflowApp is a kind of Microsoft.App/ContainerApps +// type. If supported, the resource provider must validate and +// persist this value. +type Kind string + +const ( + KindWorkflowapp Kind = "workflowapp" +) + +// PossibleKindValues returns the possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{ + KindWorkflowapp, + } +} + +// Level - The specified logger's log level. +type Level string + +const ( + LevelDebug Level = "debug" + LevelError Level = "error" + LevelInfo Level = "info" + LevelOff Level = "off" + LevelTrace Level = "trace" + LevelWarn Level = "warn" +) + +// PossibleLevelValues returns the possible values for the Level const type. +func PossibleLevelValues() []Level { + return []Level{ + LevelDebug, + LevelError, + LevelInfo, + LevelOff, + LevelTrace, + LevelWarn, + } +} + // LogLevel - Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. type LogLevel string @@ -477,6 +803,21 @@ func PossibleLogLevelValues() []LogLevel { } } +type LogicAppsProxyMethod string + +const ( + LogicAppsProxyMethodGET LogicAppsProxyMethod = "GET" + LogicAppsProxyMethodPOST LogicAppsProxyMethod = "POST" +) + +// PossibleLogicAppsProxyMethodValues returns the possible values for the LogicAppsProxyMethod const type. +func PossibleLogicAppsProxyMethodValues() []LogicAppsProxyMethod { + return []LogicAppsProxyMethod{ + LogicAppsProxyMethodGET, + LogicAppsProxyMethodPOST, + } +} + // ManagedCertificateDomainControlValidation - Selected type of domain control validation for managed certificates. type ManagedCertificateDomainControlValidation string @@ -515,6 +856,154 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } +// PatchApplyStatus - The status of the patch once it has been provisioned +type PatchApplyStatus string + +const ( + PatchApplyStatusCanceled PatchApplyStatus = "Canceled" + PatchApplyStatusCreatingRevision PatchApplyStatus = "CreatingRevision" + PatchApplyStatusImagePushPullFailed PatchApplyStatus = "ImagePushPullFailed" + PatchApplyStatusManuallySkipped PatchApplyStatus = "ManuallySkipped" + PatchApplyStatusNotStarted PatchApplyStatus = "NotStarted" + PatchApplyStatusRebaseFailed PatchApplyStatus = "RebaseFailed" + PatchApplyStatusRebaseInProgress PatchApplyStatus = "RebaseInProgress" + PatchApplyStatusRevisionCreationFailed PatchApplyStatus = "RevisionCreationFailed" + PatchApplyStatusSucceeded PatchApplyStatus = "Succeeded" +) + +// PossiblePatchApplyStatusValues returns the possible values for the PatchApplyStatus const type. +func PossiblePatchApplyStatusValues() []PatchApplyStatus { + return []PatchApplyStatus{ + PatchApplyStatusCanceled, + PatchApplyStatusCreatingRevision, + PatchApplyStatusImagePushPullFailed, + PatchApplyStatusManuallySkipped, + PatchApplyStatusNotStarted, + PatchApplyStatusRebaseFailed, + PatchApplyStatusRebaseInProgress, + PatchApplyStatusRevisionCreationFailed, + PatchApplyStatusSucceeded, + } +} + +// PatchType - The type for the patch. +type PatchType string + +const ( + PatchTypeFrameworkAndOSSecurity PatchType = "FrameworkAndOSSecurity" + PatchTypeFrameworkSecurity PatchType = "FrameworkSecurity" + PatchTypeOSSecurity PatchType = "OSSecurity" + PatchTypeOther PatchType = "Other" +) + +// PossiblePatchTypeValues returns the possible values for the PatchType const type. +func PossiblePatchTypeValues() []PatchType { + return []PatchType{ + PatchTypeFrameworkAndOSSecurity, + PatchTypeFrameworkSecurity, + PatchTypeOSSecurity, + PatchTypeOther, + } +} + +// PatchingMode - Patching mode for the container app. Null or default in this field will be interpreted as Automatic by RP. +// Automatic mode will automatically apply available patches. Manual mode will require the user +// to manually apply patches. Disabled mode will stop patch detection and auto patching. +type PatchingMode string + +const ( + PatchingModeAutomatic PatchingMode = "Automatic" + PatchingModeDisabled PatchingMode = "Disabled" + PatchingModeManual PatchingMode = "Manual" +) + +// PossiblePatchingModeValues returns the possible values for the PatchingMode const type. +func PossiblePatchingModeValues() []PatchingMode { + return []PatchingMode{ + PatchingModeAutomatic, + PatchingModeDisabled, + PatchingModeManual, + } +} + +// PoolManagementType - The pool management type of the session pool. +type PoolManagementType string + +const ( + PoolManagementTypeDynamic PoolManagementType = "Dynamic" + PoolManagementTypeManual PoolManagementType = "Manual" +) + +// PossiblePoolManagementTypeValues returns the possible values for the PoolManagementType const type. +func PossiblePoolManagementTypeValues() []PoolManagementType { + return []PoolManagementType{ + PoolManagementTypeDynamic, + PoolManagementTypeManual, + } +} + +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCanceled PrivateEndpointConnectionProvisioningState = "Canceled" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStatePending PrivateEndpointConnectionProvisioningState = "Pending" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" + PrivateEndpointConnectionProvisioningStateWaiting PrivateEndpointConnectionProvisioningState = "Waiting" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCanceled, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStatePending, + PrivateEndpointConnectionProvisioningStateSucceeded, + PrivateEndpointConnectionProvisioningStateUpdating, + PrivateEndpointConnectionProvisioningStateWaiting, + } +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusDisconnected PrivateEndpointServiceConnectionStatus = "Disconnected" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusDisconnected, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, + } +} + +// PublicNetworkAccess - Property to allow or block all public traffic. Allowed Values: 'Enabled', 'Disabled'. +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + // RevisionHealthState - Current health State of the revision type RevisionHealthState string @@ -595,6 +1084,44 @@ func PossibleSchemeValues() []Scheme { } } +// SessionNetworkStatus - Network status for the sessions. +type SessionNetworkStatus string + +const ( + SessionNetworkStatusEgressDisabled SessionNetworkStatus = "EgressDisabled" + SessionNetworkStatusEgressEnabled SessionNetworkStatus = "EgressEnabled" +) + +// PossibleSessionNetworkStatusValues returns the possible values for the SessionNetworkStatus const type. +func PossibleSessionNetworkStatusValues() []SessionNetworkStatus { + return []SessionNetworkStatus{ + SessionNetworkStatusEgressDisabled, + SessionNetworkStatusEgressEnabled, + } +} + +// SessionPoolProvisioningState - Provisioning state of the session pool. +type SessionPoolProvisioningState string + +const ( + SessionPoolProvisioningStateCanceled SessionPoolProvisioningState = "Canceled" + SessionPoolProvisioningStateDeleting SessionPoolProvisioningState = "Deleting" + SessionPoolProvisioningStateFailed SessionPoolProvisioningState = "Failed" + SessionPoolProvisioningStateInProgress SessionPoolProvisioningState = "InProgress" + SessionPoolProvisioningStateSucceeded SessionPoolProvisioningState = "Succeeded" +) + +// PossibleSessionPoolProvisioningStateValues returns the possible values for the SessionPoolProvisioningState const type. +func PossibleSessionPoolProvisioningStateValues() []SessionPoolProvisioningState { + return []SessionPoolProvisioningState{ + SessionPoolProvisioningStateCanceled, + SessionPoolProvisioningStateDeleting, + SessionPoolProvisioningStateFailed, + SessionPoolProvisioningStateInProgress, + SessionPoolProvisioningStateSucceeded, + } +} + // SourceControlOperationState - Current provisioning State of the operation type SourceControlOperationState string @@ -619,9 +1146,11 @@ func PossibleSourceControlOperationStateValues() []SourceControlOperationState { type StorageType string const ( - StorageTypeAzureFile StorageType = "AzureFile" - StorageTypeEmptyDir StorageType = "EmptyDir" - StorageTypeSecret StorageType = "Secret" + StorageTypeAzureFile StorageType = "AzureFile" + StorageTypeEmptyDir StorageType = "EmptyDir" + StorageTypeNfsAzureFile StorageType = "NfsAzureFile" + StorageTypeSecret StorageType = "Secret" + StorageTypeSmb StorageType = "Smb" ) // PossibleStorageTypeValues returns the possible values for the StorageType const type. @@ -629,7 +1158,9 @@ func PossibleStorageTypeValues() []StorageType { return []StorageType{ StorageTypeAzureFile, StorageTypeEmptyDir, + StorageTypeNfsAzureFile, StorageTypeSecret, + StorageTypeSmb, } } @@ -688,3 +1219,47 @@ func PossibleUnauthenticatedClientActionV2Values() []UnauthenticatedClientAction UnauthenticatedClientActionV2Return403, } } + +// WorkflowHealthState - Gets or sets the workflow health state. +type WorkflowHealthState string + +const ( + WorkflowHealthStateHealthy WorkflowHealthState = "Healthy" + WorkflowHealthStateNotSpecified WorkflowHealthState = "NotSpecified" + WorkflowHealthStateUnhealthy WorkflowHealthState = "Unhealthy" + WorkflowHealthStateUnknown WorkflowHealthState = "Unknown" +) + +// PossibleWorkflowHealthStateValues returns the possible values for the WorkflowHealthState const type. +func PossibleWorkflowHealthStateValues() []WorkflowHealthState { + return []WorkflowHealthState{ + WorkflowHealthStateHealthy, + WorkflowHealthStateNotSpecified, + WorkflowHealthStateUnhealthy, + WorkflowHealthStateUnknown, + } +} + +// WorkflowState - The workflow state. +type WorkflowState string + +const ( + WorkflowStateCompleted WorkflowState = "Completed" + WorkflowStateDeleted WorkflowState = "Deleted" + WorkflowStateDisabled WorkflowState = "Disabled" + WorkflowStateEnabled WorkflowState = "Enabled" + WorkflowStateNotSpecified WorkflowState = "NotSpecified" + WorkflowStateSuspended WorkflowState = "Suspended" +) + +// PossibleWorkflowStateValues returns the possible values for the WorkflowState const type. +func PossibleWorkflowStateValues() []WorkflowState { + return []WorkflowState{ + WorkflowStateCompleted, + WorkflowStateDeleted, + WorkflowStateDisabled, + WorkflowStateEnabled, + WorkflowStateNotSpecified, + WorkflowStateSuspended, + } +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go index 6fcb279fa0..ab664ab269 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ContainerAppsClient struct { } // NewContainerAppsClient creates a new instance of ContainerAppsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewContainerAppsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsClient, error) { @@ -46,7 +47,7 @@ func NewContainerAppsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create or update a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -73,7 +74,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-03-01 +// Generated from API version 2024-08-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" @@ -115,7 +116,7 @@ func (client *ContainerAppsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, containerAppEnvelope); err != nil { @@ -127,7 +128,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-03-01 +// Generated from API version 2024-08-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 @@ -153,7 +154,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-03-01 +// Generated from API version 2024-08-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" @@ -195,7 +196,7 @@ func (client *ContainerAppsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +205,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-03-01 +// Generated from API version 2024-08-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. @@ -250,7 +251,7 @@ func (client *ContainerAppsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +269,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-03-01 +// Generated from API version 2024-08-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 @@ -315,7 +316,7 @@ func (client *ContainerAppsClient) getAuthTokenCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,7 +333,7 @@ func (client *ContainerAppsClient) getAuthTokenHandleResponse(resp *http.Respons // NewListByResourceGroupPager - Get the Container Apps in a given resource group. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -375,7 +376,7 @@ func (client *ContainerAppsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -392,7 +393,7 @@ func (client *ContainerAppsClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - Get the Container Apps in a given subscription. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-02-preview // - options - ContainerAppsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsClient.NewListBySubscriptionPager // method. func (client *ContainerAppsClient) NewListBySubscriptionPager(options *ContainerAppsClientListBySubscriptionOptions) *runtime.Pager[ContainerAppsClientListBySubscriptionResponse] { @@ -430,7 +431,7 @@ func (client *ContainerAppsClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -448,7 +449,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-03-01 +// Generated from API version 2024-08-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 @@ -495,7 +496,7 @@ func (client *ContainerAppsClient) listCustomHostNameAnalysisCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") if options != nil && options.CustomHostname != nil { reqQP.Set("customHostname", *options.CustomHostname) } @@ -516,7 +517,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-03-01 +// Generated from API version 2024-08-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 @@ -563,7 +564,7 @@ func (client *ContainerAppsClient) listSecretsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -581,7 +582,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-03-01 +// Generated from API version 2024-08-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 @@ -607,7 +608,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-03-01 +// Generated from API version 2024-08-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" @@ -649,7 +650,7 @@ func (client *ContainerAppsClient) startCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -658,7 +659,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-03-01 +// Generated from API version 2024-08-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. @@ -683,7 +684,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-03-01 +// Generated from API version 2024-08-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" @@ -725,7 +726,7 @@ func (client *ContainerAppsClient) stopCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -734,7 +735,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-03-01 +// Generated from API version 2024-08-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 @@ -760,7 +761,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-03-01 +// Generated from API version 2024-08-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" @@ -802,7 +803,7 @@ func (client *ContainerAppsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index e247d4120f..21bd838105 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerapps_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListBySubscription.json +// 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 { @@ -43,9 +43,9 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // page.ContainerAppCollection = armappcontainers.ContainerAppCollection{ // Value: []*armappcontainers.ContainerApp{ // { - // Name: to.Ptr("testcontainerapp0"), + // 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"), + // 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{ @@ -71,7 +71,7 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // 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"), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ // { // Name: to.Ptr("Allow work IP A subnet"), @@ -89,50 +89,71 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // Affinity: to.Ptr(armappcontainers.AffinitySticky), // }, // TargetPort: to.Ptr[int32](3000), + // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), // Traffic: []*armappcontainers.TrafficWeight{ // { - // RevisionName: to.Ptr("testcontainerapp0-ab1234"), + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), // Weight: to.Ptr[int32](80), // }, // { // Label: to.Ptr("staging"), - // RevisionName: to.Ptr("testcontainerapp0-ab4321"), + // 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"), + // 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"), + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerApp0"), - // Image: to.Ptr("repo/testcontainerapp0:v4"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), @@ -146,6 +167,10 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { // 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"), // }}, // }, @@ -156,7 +181,7 @@ func ExampleContainerAppsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListByResourceGroup.json +// 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 { @@ -181,9 +206,9 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // page.ContainerAppCollection = armappcontainers.ContainerAppCollection{ // Value: []*armappcontainers.ContainerApp{ // { - // Name: to.Ptr("testcontainerapp0"), + // 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"), + // 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{ @@ -209,7 +234,7 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // 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"), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ // { // Name: to.Ptr("Allow work IP A subnet"), @@ -227,47 +252,68 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // Affinity: to.Ptr(armappcontainers.AffinitySticky), // }, // TargetPort: to.Ptr[int32](3000), + // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), // Traffic: []*armappcontainers.TrafficWeight{ // { - // RevisionName: to.Ptr("testcontainerapp0-ab1234"), + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), // Weight: to.Ptr[int32](80), // }, // { // Label: to.Ptr("staging"), - // RevisionName: to.Ptr("testcontainerapp0-ab4321"), + // 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"), + // 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"), + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerApp0"), - // Image: to.Ptr("repo/testcontainerapp0:v4"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), @@ -281,12 +327,63 @@ func ExampleContainerAppsClient_NewListByResourceGroupPager() { // }, // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Get.json +// 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 { @@ -297,7 +394,7 @@ func ExampleContainerAppsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewContainerAppsClient().Get(ctx, "rg", "testcontainerapp0", nil) + res, err := clientFactory.NewContainerAppsClient().Get(ctx, "rg", "testcontainerApp0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -305,10 +402,21 @@ func ExampleContainerAppsClient_Get() { _ = 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"), + // 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"), + // 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{ @@ -320,6 +428,15 @@ func ExampleContainerAppsClient_Get() { // 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{ // { @@ -333,7 +450,7 @@ func ExampleContainerAppsClient_Get() { // 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"), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ // { // Name: to.Ptr("Allow work IP A subnet"), @@ -351,50 +468,82 @@ func ExampleContainerAppsClient_Get() { // Affinity: to.Ptr(armappcontainers.AffinitySticky), // }, // TargetPort: to.Ptr[int32](3000), + // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), // Traffic: []*armappcontainers.TrafficWeight{ // { - // RevisionName: to.Ptr("testcontainerapp0-ab1234"), + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), // Weight: to.Ptr[int32](80), // }, // { // Label: to.Ptr("staging"), - // RevisionName: to.Ptr("testcontainerapp0-ab4321"), + // 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"), + // 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"), + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), @@ -403,20 +552,481 @@ func ExampleContainerAppsClient_Get() { // "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_CreateOrUpdate.json +// 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 { @@ -427,7 +1037,595 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewContainerAppsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerapp0", armappcontainers.ContainerApp{ + 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{ @@ -500,7 +1698,7 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() Traffic: []*armappcontainers.TrafficWeight{ { Label: to.Ptr("production"), - RevisionName: to.Ptr("testcontainerapp0-ab1234"), + RevisionName: to.Ptr("testcontainerApp0-ab1234"), Weight: to.Ptr[int32](100), }}, }, @@ -510,11 +1708,26 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() }, }, 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("repo/testcontainerapp0:v1"), + 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), @@ -539,15 +1752,17 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() to.Ptr("while true; do echo hello; sleep 10;done")}, Command: []*string{ to.Ptr("/bin/sh")}, - Image: to.Ptr("repo/testcontainerapp0:v4"), + Image: to.Ptr("repo/testcontainerApp0:v4"), Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](0.5), - Memory: to.Ptr("1Gi"), + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), }, }}, Scale: &armappcontainers.Scale{ - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), + 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"), @@ -561,9 +1776,24 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() }, ServiceBinds: []*armappcontainers.ServiceBind{ { - Name: to.Ptr("redisService"), + 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"), }, @@ -579,9 +1809,9 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() _ = 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"), + // 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"), + // 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{ @@ -604,7 +1834,7 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() // 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"), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ // { // Name: to.Ptr("Allow work IP A subnet"), @@ -622,33 +1852,49 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() // Affinity: to.Ptr(armappcontainers.AffinitySticky), // }, // TargetPort: to.Ptr[int32](3000), + // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), // Traffic: []*armappcontainers.TrafficWeight{ // { - // RevisionName: to.Ptr("testcontainerapp0-ab1234"), + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), // Weight: to.Ptr[int32](80), // }, // { // Label: to.Ptr("staging"), - // RevisionName: to.Ptr("testcontainerapp0-ab4321"), + // 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"), + // 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("repo/testcontainerapp0:v4"), + // 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.5), - // Memory: to.Ptr("1Gi"), + // 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), @@ -673,10 +1919,10 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() // to.Ptr("while true; do echo hello; sleep 10;done")}, // Command: []*string{ // to.Ptr("/bin/sh")}, - // Image: to.Ptr("repo/testcontainerapp0:v4"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // Scale: &armappcontainers.Scale{ @@ -692,149 +1938,24 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateContainerApp() // }, // }}, // }, + // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ManagedBy_CreateOrUpdate.json -func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateManagedByApp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcontainers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewContainerAppsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerappmanagedby", armappcontainers.ContainerApp{ - Location: to.Ptr("East US"), - ManagedBy: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp"), - Properties: &armappcontainers.ContainerAppProperties{ - Configuration: &armappcontainers.Configuration{ - Ingress: &armappcontainers.Ingress{ - ExposedPort: to.Ptr[int32](4000), - External: to.Ptr(true), - TargetPort: to.Ptr[int32](3000), - Traffic: []*armappcontainers.TrafficWeight{ - { - RevisionName: to.Ptr("testcontainerappmanagedby-ab1234"), - Weight: to.Ptr[int32](100), - }}, - Transport: to.Ptr(armappcontainers.IngressTransportMethodTCP), - }, - }, - EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - Template: &armappcontainers.Template{ - Containers: []*armappcontainers.Container{ - { - Name: to.Ptr("testcontainerappmanagedby"), - Image: to.Ptr("repo/testcontainerappmanagedby:v1"), - Probes: []*armappcontainers.ContainerAppProbe{ - { - Type: to.Ptr(armappcontainers.TypeLiveness), - InitialDelaySeconds: to.Ptr[int32](3), - PeriodSeconds: to.Ptr[int32](3), - TCPSocket: &armappcontainers.ContainerAppProbeTCPSocket{ - Port: to.Ptr[int32](8080), - }, - }}, - }}, - Scale: &armappcontainers.Scale{ - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), - Rules: []*armappcontainers.ScaleRule{ - { - Name: to.Ptr("tcpscalingrule"), - TCP: &armappcontainers.TCPScaleRule{ - Metadata: map[string]*string{ - "concurrentConnections": to.Ptr("50"), - }, - }, - }}, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ContainerApp = armappcontainers.ContainerApp{ - // Name: to.Ptr("testcontainerappmanagedby"), - // Type: to.Ptr("Microsoft.App/containerApps"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerappmanagedby"), - // Location: to.Ptr("East US"), - // ManagedBy: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp"), - // Properties: &armappcontainers.ContainerAppProperties{ - // Configuration: &armappcontainers.Configuration{ - // Ingress: &armappcontainers.Ingress{ - // ExposedPort: to.Ptr[int32](4000), - // External: to.Ptr(true), - // Fqdn: to.Ptr("testcontainerappmanagedby.demokube-t24clv0g.eastus.containerApps.k4apps.io"), - // TargetPort: to.Ptr[int32](3000), - // Traffic: []*armappcontainers.TrafficWeight{ - // { - // RevisionName: to.Ptr("testcontainerappmanagedby-ab1234"), - // Weight: to.Ptr[int32](80), - // }, - // { - // RevisionName: to.Ptr("testcontainerappmanagedby-ab4321"), - // Weight: to.Ptr[int32](20), - // }}, - // Transport: to.Ptr(armappcontainers.IngressTransportMethodTCP), - // }, - // }, - // LatestReadyRevisionName: to.Ptr("testcontainerappmanagedby-pjxhsye"), - // LatestRevisionFqdn: to.Ptr("testcontainerappmanagedby-pjxhsye.demokube-t24clv0g.eastus.containerApps.k4apps.io"), - // ManagedEnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"), - // ProvisioningState: to.Ptr(armappcontainers.ContainerAppProvisioningStateSucceeded), - // Template: &armappcontainers.Template{ - // Containers: []*armappcontainers.Container{ - // { - // Name: to.Ptr("testcontainerappmanagedby"), - // Image: to.Ptr("repo/testcontainerappmanagedby:v4"), - // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), - // }, - // Probes: []*armappcontainers.ContainerAppProbe{ - // { - // Type: to.Ptr(armappcontainers.TypeLiveness), - // InitialDelaySeconds: to.Ptr[int32](3), - // PeriodSeconds: to.Ptr[int32](3), - // TCPSocket: &armappcontainers.ContainerAppProbeTCPSocket{ - // Port: to.Ptr[int32](8080), - // }, - // }}, - // }}, - // Scale: &armappcontainers.Scale{ - // MaxReplicas: to.Ptr[int32](5), - // MinReplicas: to.Ptr[int32](1), - // Rules: []*armappcontainers.ScaleRule{ - // { - // Name: to.Ptr("tcpscalingrule"), - // TCP: &armappcontainers.TCPScaleRule{ - // Metadata: map[string]*string{ - // "concurrentConnections": to.Ptr("50"), - // }, - // }, - // }}, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_TcpApp_CreateOrUpdate.json +// 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 { @@ -845,7 +1966,7 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateTcpApp() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewContainerAppsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerapptcp", armappcontainers.ContainerApp{ + poller, err := clientFactory.NewContainerAppsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerAppTcp", armappcontainers.ContainerApp{ Location: to.Ptr("East US"), Properties: &armappcontainers.ContainerAppProperties{ Configuration: &armappcontainers.Configuration{ @@ -855,7 +1976,7 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateTcpApp() { TargetPort: to.Ptr[int32](3000), Traffic: []*armappcontainers.TrafficWeight{ { - RevisionName: to.Ptr("testcontainerapptcp-ab1234"), + RevisionName: to.Ptr("testcontainerAppTcp-ab1234"), Weight: to.Ptr[int32](100), }}, Transport: to.Ptr(armappcontainers.IngressTransportMethodTCP), @@ -865,8 +1986,8 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateTcpApp() { Template: &armappcontainers.Template{ Containers: []*armappcontainers.Container{ { - Name: to.Ptr("testcontainerapptcp"), - Image: to.Ptr("repo/testcontainerapptcp:v1"), + Name: to.Ptr("testcontainerAppTcp"), + Image: to.Ptr("repo/testcontainerAppTcp:v1"), Probes: []*armappcontainers.ContainerAppProbe{ { Type: to.Ptr(armappcontainers.TypeLiveness), @@ -878,8 +1999,10 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateTcpApp() { }}, }}, Scale: &armappcontainers.Scale{ - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), + 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"), @@ -904,41 +2027,41 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateTcpApp() { _ = 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"), + // 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"), + // 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"), + // Fqdn: to.Ptr("testcontainerAppTcp.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // TargetPort: to.Ptr[int32](3000), // Traffic: []*armappcontainers.TrafficWeight{ // { - // RevisionName: to.Ptr("testcontainerapptcp-ab1234"), + // RevisionName: to.Ptr("testcontainerAppTcp-ab1234"), // Weight: to.Ptr[int32](80), // }, // { - // RevisionName: to.Ptr("testcontainerapptcp-ab4321"), + // 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"), + // 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"), + // Name: to.Ptr("testcontainerAppTcp"), + // Image: to.Ptr("repo/testcontainerAppTcp:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // Probes: []*armappcontainers.ContainerAppProbe{ // { @@ -951,8 +2074,10 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateTcpApp() { // }}, // }}, // 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"), @@ -968,7 +2093,7 @@ func ExampleContainerAppsClient_BeginCreateOrUpdate_createOrUpdateTcpApp() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Delete.json +// 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 { @@ -979,7 +2104,7 @@ func ExampleContainerAppsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewContainerAppsClient().BeginDelete(ctx, "rg", "testworkerapp0", nil) + poller, err := clientFactory.NewContainerAppsClient().BeginDelete(ctx, "rg", "testWorkerApp0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -989,7 +2114,7 @@ func ExampleContainerAppsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Patch.json +// 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 { @@ -1000,7 +2125,7 @@ func ExampleContainerAppsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewContainerAppsClient().BeginUpdate(ctx, "rg", "testcontainerapp0", armappcontainers.ContainerApp{ + poller, err := clientFactory.NewContainerAppsClient().BeginUpdate(ctx, "rg", "testcontainerApp0", armappcontainers.ContainerApp{ Location: to.Ptr("East US"), Tags: map[string]*string{ "tag1": to.Ptr("value1"), @@ -1050,11 +2175,29 @@ func ExampleContainerAppsClient_BeginUpdate() { Traffic: []*armappcontainers.TrafficWeight{ { Label: to.Ptr("production"), - RevisionName: to.Ptr("testcontainerapp0-ab1234"), + 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"), }, @@ -1062,8 +2205,8 @@ func ExampleContainerAppsClient_BeginUpdate() { Template: &armappcontainers.Template{ Containers: []*armappcontainers.Container{ { - Name: to.Ptr("testcontainerapp0"), - Image: to.Ptr("repo/testcontainerapp0:v1"), + Name: to.Ptr("testcontainerApp0"), + Image: to.Ptr("repo/testcontainerApp0:v1"), Probes: []*armappcontainers.ContainerAppProbe{ { Type: to.Ptr(armappcontainers.TypeLiveness), @@ -1083,15 +2226,17 @@ func ExampleContainerAppsClient_BeginUpdate() { InitContainers: []*armappcontainers.InitContainer{ { Name: to.Ptr("testinitcontainerApp0"), - Image: to.Ptr("repo/testcontainerapp0:v4"), + Image: to.Ptr("repo/testcontainerApp0:v4"), Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](0.5), - Memory: to.Ptr("1Gi"), + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), }, }}, Scale: &armappcontainers.Scale{ - MaxReplicas: to.Ptr[int32](5), - MinReplicas: to.Ptr[int32](1), + 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"), @@ -1105,7 +2250,11 @@ func ExampleContainerAppsClient_BeginUpdate() { }, ServiceBinds: []*armappcontainers.ServiceBind{ { - Name: to.Ptr("service"), + 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"), }}, }, @@ -1122,9 +2271,9 @@ func ExampleContainerAppsClient_BeginUpdate() { _ = 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"), + // 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"), + // 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{ @@ -1150,7 +2299,7 @@ func ExampleContainerAppsClient_BeginUpdate() { // 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"), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ // { // Name: to.Ptr("Allow work IP A subnet"), @@ -1165,47 +2314,68 @@ func ExampleContainerAppsClient_BeginUpdate() { // 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"), + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), // Weight: to.Ptr[int32](80), // }, // { // Label: to.Ptr("staging"), - // RevisionName: to.Ptr("testcontainerapp0-ab4321"), + // 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"), + // 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"), + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerApp0"), - // Image: to.Ptr("repo/testcontainerapp0:v4"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), @@ -1222,7 +2392,7 @@ func ExampleContainerAppsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListCustomHostNameAnalysis.json +// 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 { @@ -1233,7 +2403,7 @@ func ExampleContainerAppsClient_ListCustomHostNameAnalysis() { 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")}) + 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) } @@ -1266,7 +2436,7 @@ func ExampleContainerAppsClient_ListCustomHostNameAnalysis() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListSecrets.json +// 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 { @@ -1277,7 +2447,7 @@ func ExampleContainerAppsClient_ListSecrets() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewContainerAppsClient().ListSecrets(ctx, "rg", "testcontainerapp0", nil) + res, err := clientFactory.NewContainerAppsClient().ListSecrets(ctx, "rg", "testcontainerApp0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1295,7 +2465,7 @@ func ExampleContainerAppsClient_ListSecrets() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_GetAuthToken.json +// 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 { @@ -1306,7 +2476,7 @@ func ExampleContainerAppsClient_GetAuthToken() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewContainerAppsClient().GetAuthToken(ctx, "rg", "testcontainerapp0", nil) + res, err := clientFactory.NewContainerAppsClient().GetAuthToken(ctx, "rg", "testcontainerApp0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1314,9 +2484,9 @@ func ExampleContainerAppsClient_GetAuthToken() { _ = 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"), + // 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"), + // 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}()), @@ -1325,7 +2495,7 @@ func ExampleContainerAppsClient_GetAuthToken() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Start.json +// 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 { @@ -1336,7 +2506,7 @@ func ExampleContainerAppsClient_BeginStart() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewContainerAppsClient().BeginStart(ctx, "rg", "testworkerapp0", nil) + poller, err := clientFactory.NewContainerAppsClient().BeginStart(ctx, "rg", "testWorkerApp0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1348,9 +2518,9 @@ func ExampleContainerAppsClient_BeginStart() { _ = 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"), + // 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"), + // 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{ @@ -1376,7 +2546,7 @@ func ExampleContainerAppsClient_BeginStart() { // 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"), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ // { // Name: to.Ptr("Allow work IP A subnet"), @@ -1391,47 +2561,68 @@ func ExampleContainerAppsClient_BeginStart() { // 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"), + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), // Weight: to.Ptr[int32](80), // }, // { // Label: to.Ptr("staging"), - // RevisionName: to.Ptr("testcontainerapp0-ab4321"), + // 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"), + // 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"), + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerApp0"), - // Image: to.Ptr("repo/testcontainerapp0:v4"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), @@ -1448,7 +2639,7 @@ func ExampleContainerAppsClient_BeginStart() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Stop.json +// 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 { @@ -1459,7 +2650,7 @@ func ExampleContainerAppsClient_BeginStop() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewContainerAppsClient().BeginStop(ctx, "rg", "testworkerApp0", nil) + poller, err := clientFactory.NewContainerAppsClient().BeginStop(ctx, "rg", "testWorkerApp0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1471,9 +2662,9 @@ func ExampleContainerAppsClient_BeginStop() { _ = 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"), + // 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"), + // 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{ @@ -1499,7 +2690,7 @@ func ExampleContainerAppsClient_BeginStop() { // 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"), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ // { // Name: to.Ptr("Allow work IP A subnet"), @@ -1514,30 +2705,49 @@ func ExampleContainerAppsClient_BeginStop() { // 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"), + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), // Weight: to.Ptr[int32](80), // }, // { // Label: to.Ptr("staging"), - // RevisionName: to.Ptr("testcontainerapp0-ab4321"), + // 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"), + // 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"), + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ // CPU: to.Ptr[float64](0.2), // Memory: to.Ptr("100Mi"), @@ -1546,10 +2756,10 @@ func ExampleContainerAppsClient_BeginStop() { // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerApp0"), - // Image: to.Ptr("repo/testcontainerapp0:v4"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // Scale: &armappcontainers.Scale{ diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client.go index 252f60aa6b..c453cc31cf 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ContainerAppsAPIClient struct { } // NewContainerAppsAPIClient creates a new instance of ContainerAppsAPIClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewContainerAppsAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsAPIClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-02-preview // - options - ContainerAppsAPIClientGetCustomDomainVerificationIDOptions contains the optional parameters for the ContainerAppsAPIClient.GetCustomDomainVerificationID // method. func (client *ContainerAppsAPIClient) GetCustomDomainVerificationID(ctx context.Context, options *ContainerAppsAPIClientGetCustomDomainVerificationIDOptions) (ContainerAppsAPIClientGetCustomDomainVerificationIDResponse, error) { @@ -83,7 +84,7 @@ func (client *ContainerAppsAPIClient) getCustomDomainVerificationIDCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -101,7 +102,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-03-01 +// Generated from API version 2024-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - jobExecutionName - Job execution name. @@ -153,7 +154,7 @@ func (client *ContainerAppsAPIClient) jobExecutionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index f7228eebb4..aed27d2c0a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsapi_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Execution_Get.json +// 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 { @@ -28,7 +28,7 @@ func ExampleContainerAppsAPIClient_JobExecution() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewContainerAppsAPIClient().JobExecution(ctx, "rg", "testcontainerappsjob0", "jobExecution1", nil) + res, err := clientFactory.NewContainerAppsAPIClient().JobExecution(ctx, "rg", "testcontainerAppsJob0", "jobExecution1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -70,7 +70,7 @@ func ExampleContainerAppsAPIClient_JobExecution() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Subscriptions_GetCustomDomainVerificationId.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go index c11e4962d5..f39e84d136 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ContainerAppsAuthConfigsClient struct { } // NewContainerAppsAuthConfigsClient creates a new instance of ContainerAppsAuthConfigsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewContainerAppsAuthConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsAuthConfigsClient, error) { @@ -46,7 +47,7 @@ func NewContainerAppsAuthConfigsClient(subscriptionID string, credential azcore. // CreateOrUpdate - Create or update the AuthConfig for a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -99,7 +100,7 @@ func (client *ContainerAppsAuthConfigsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, authConfigEnvelope); err != nil { @@ -120,7 +121,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-03-01 +// Generated from API version 2024-08-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. @@ -171,7 +172,7 @@ func (client *ContainerAppsAuthConfigsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +181,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-03-01 +// Generated from API version 2024-08-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. @@ -232,7 +233,7 @@ func (client *ContainerAppsAuthConfigsClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +250,7 @@ func (client *ContainerAppsAuthConfigsClient) getHandleResponse(resp *http.Respo // NewListByContainerAppPager - Get the Container App AuthConfigs in a given resource group. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -297,7 +298,7 @@ func (client *ContainerAppsAuthConfigsClient) listByContainerAppCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index ef1ef7f286..7d0196ecd6 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsauthconfigs_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_ListByContainer.json +// 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 { @@ -71,7 +71,7 @@ func ExampleContainerAppsAuthConfigsClient_NewListByContainerAppPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_Get.json +// 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 { @@ -116,7 +116,7 @@ func ExampleContainerAppsAuthConfigsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_CreateOrUpdate.json +// 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 { @@ -182,7 +182,7 @@ func ExampleContainerAppsAuthConfigsClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_Delete.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client.go new file mode 100644 index 0000000000..61004bf94a --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client.go @@ -0,0 +1,196 @@ +//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" + "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" +) + +// ContainerAppsBuildsClient contains the methods for the ContainerAppsBuilds group. +// Don't use this type directly, use NewContainerAppsBuildsClient() instead. +type ContainerAppsBuildsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContainerAppsBuildsClient creates a new instance of ContainerAppsBuildsClient 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 NewContainerAppsBuildsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsBuildsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContainerAppsBuildsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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. +// - options - ContainerAppsBuildsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsBuildsClient.BeginDelete +// method. +func (client *ContainerAppsBuildsClient) BeginDelete(ctx context.Context, resourceGroupName string, containerAppName string, buildName string, options *ContainerAppsBuildsClientBeginDeleteOptions) (*runtime.Poller[ContainerAppsBuildsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, containerAppName, buildName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsBuildsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainerAppsBuildsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, containerAppName, buildName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContainerAppsBuildsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, buildName string, options *ContainerAppsBuildsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}" + 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 buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 +// - 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. +// - options - ContainerAppsBuildsClientGetOptions contains the optional parameters for the ContainerAppsBuildsClient.Get method. +func (client *ContainerAppsBuildsClient) Get(ctx context.Context, resourceGroupName string, containerAppName string, buildName string, options *ContainerAppsBuildsClientGetOptions) (ContainerAppsBuildsClientGetResponse, error) { + var err error + const operationName = "ContainerAppsBuildsClient.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, containerAppName, buildName, options) + if err != nil { + return ContainerAppsBuildsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsBuildsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ContainerAppsBuildsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ContainerAppsBuildsClient) getCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, buildName string, options *ContainerAppsBuildsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}" + 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 buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + 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-08-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 *ContainerAppsBuildsClient) getHandleResponse(resp *http.Response) (ContainerAppsBuildsClientGetResponse, error) { + result := ContainerAppsBuildsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerAppsBuildResource); err != nil { + return ContainerAppsBuildsClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client_example_test.go new file mode 100644 index 0000000000..f329bf80de --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuilds_client_example_test.go @@ -0,0 +1,121 @@ +//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 new file mode 100644 index 0000000000..3327e91716 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// ContainerAppsBuildsByContainerAppClient contains the methods for the ContainerAppsBuildsByContainerApp group. +// Don't use this type directly, use NewContainerAppsBuildsByContainerAppClient() instead. +type ContainerAppsBuildsByContainerAppClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContainerAppsBuildsByContainerAppClient creates a new instance of ContainerAppsBuildsByContainerAppClient 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 NewContainerAppsBuildsByContainerAppClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsBuildsByContainerAppClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContainerAppsBuildsByContainerAppClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List Container Apps Build resources by Container App +// +// Generated from API version 2024-08-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 +// method. +func (client *ContainerAppsBuildsByContainerAppClient) NewListPager(resourceGroupName string, containerAppName string, options *ContainerAppsBuildsByContainerAppClientListOptions) *runtime.Pager[ContainerAppsBuildsByContainerAppClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsBuildsByContainerAppClientListResponse]{ + More: func(page ContainerAppsBuildsByContainerAppClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsBuildsByContainerAppClientListResponse) (ContainerAppsBuildsByContainerAppClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainerAppsBuildsByContainerAppClient.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, containerAppName, options) + }, nil) + if err != nil { + return ContainerAppsBuildsByContainerAppClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ContainerAppsBuildsByContainerAppClient) listCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsBuildsByContainerAppClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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 *ContainerAppsBuildsByContainerAppClient) listHandleResponse(resp *http.Response) (ContainerAppsBuildsByContainerAppClientListResponse, error) { + result := ContainerAppsBuildsByContainerAppClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerAppsBuildCollection); err != nil { + return ContainerAppsBuildsByContainerAppClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client_example_test.go new file mode 100644 index 0000000000..a023eade55 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsbuildsbycontainerapp_client_example_test.go @@ -0,0 +1,170 @@ +//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 5180440f4e..a857a07a9b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ContainerAppsDiagnosticsClient struct { } // NewContainerAppsDiagnosticsClient creates a new instance of ContainerAppsDiagnosticsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewContainerAppsDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsDiagnosticsClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-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. @@ -98,7 +99,7 @@ func (client *ContainerAppsDiagnosticsClient) getDetectorCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,7 +117,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-03-01 +// Generated from API version 2024-08-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. @@ -168,7 +169,7 @@ func (client *ContainerAppsDiagnosticsClient) getRevisionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,7 +187,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-03-01 +// Generated from API version 2024-08-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 @@ -233,7 +234,7 @@ func (client *ContainerAppsDiagnosticsClient) getRootCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +251,7 @@ func (client *ContainerAppsDiagnosticsClient) getRootHandleResponse(resp *http.R // NewListDetectorsPager - Get the list of diagnostics for a given Container App. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -298,7 +299,7 @@ func (client *ContainerAppsDiagnosticsClient) listDetectorsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -315,7 +316,7 @@ func (client *ContainerAppsDiagnosticsClient) listDetectorsHandleResponse(resp * // NewListRevisionsPager - Get the Revisions for a given Container App. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -366,7 +367,7 @@ func (client *ContainerAppsDiagnosticsClient) listRevisionsCreateRequest(ctx con if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 2f2c56037a..9c884ff40e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsdiagnostics_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerAppsDiagnostics_List.json +// 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 { @@ -67,7 +67,7 @@ func ExampleContainerAppsDiagnosticsClient_NewListDetectorsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerAppsDiagnostics_Get.json +// 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 { @@ -139,7 +139,7 @@ func ExampleContainerAppsDiagnosticsClient_GetDetector() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_List.json +// 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 { @@ -204,7 +204,7 @@ func ExampleContainerAppsDiagnosticsClient_NewListRevisionsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Get.json +// 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 { @@ -225,7 +225,7 @@ func ExampleContainerAppsDiagnosticsClient_GetRevision() { // res.Revision = armappcontainers.Revision{ // Name: to.Ptr("testcontainerApp0-pjxhsye"), // Type: to.Ptr("Microsoft.App/containerApps/revisions"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppcontainerApps/testcontainerApp0/revisions/testcontainerApp0-pjxhsye"), + // 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}()), @@ -262,7 +262,7 @@ func ExampleContainerAppsDiagnosticsClient_GetRevision() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Get.json +// 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 { @@ -273,7 +273,7 @@ func ExampleContainerAppsDiagnosticsClient_GetRoot() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewContainerAppsDiagnosticsClient().GetRoot(ctx, "rg", "testcontainerapp0", nil) + res, err := clientFactory.NewContainerAppsDiagnosticsClient().GetRoot(ctx, "rg", "testcontainerApp0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -281,10 +281,21 @@ func ExampleContainerAppsDiagnosticsClient_GetRoot() { _ = 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"), + // 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"), + // 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{ @@ -296,6 +307,15 @@ func ExampleContainerAppsDiagnosticsClient_GetRoot() { // 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{ // { @@ -309,7 +329,7 @@ func ExampleContainerAppsDiagnosticsClient_GetRoot() { // 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"), + // Fqdn: to.Ptr("testcontainerApp0.demokube-t24clv0g.eastus.containerApps.k4apps.io"), // IPSecurityRestrictions: []*armappcontainers.IPSecurityRestrictionRule{ // { // Name: to.Ptr("Allow work IP A subnet"), @@ -327,50 +347,82 @@ func ExampleContainerAppsDiagnosticsClient_GetRoot() { // Affinity: to.Ptr(armappcontainers.AffinitySticky), // }, // TargetPort: to.Ptr[int32](3000), + // TargetPortHTTPScheme: to.Ptr(armappcontainers.IngressTargetPortHTTPSchemeHTTP), // Traffic: []*armappcontainers.TrafficWeight{ // { - // RevisionName: to.Ptr("testcontainerapp0-ab1234"), + // RevisionName: to.Ptr("testcontainerApp0-ab1234"), // Weight: to.Ptr[int32](80), // }, // { // Label: to.Ptr("staging"), - // RevisionName: to.Ptr("testcontainerapp0-ab4321"), + // 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"), + // 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"), + // Name: to.Ptr("testcontainerApp0"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), + // Image: to.Ptr("repo/testcontainerApp0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), @@ -379,13 +431,40 @@ func ExampleContainerAppsDiagnosticsClient_GetRoot() { // "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/containerappspatches_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client.go new file mode 100644 index 0000000000..b9a04f945f --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client.go @@ -0,0 +1,433 @@ +//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" + "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" +) + +// ContainerAppsPatchesClient contains the methods for the ContainerAppsPatches group. +// Don't use this type directly, use NewContainerAppsPatchesClient() instead. +type ContainerAppsPatchesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContainerAppsPatchesClient creates a new instance of ContainerAppsPatchesClient 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 NewContainerAppsPatchesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsPatchesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContainerAppsPatchesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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 +// - options - ContainerAppsPatchesClientBeginApplyOptions contains the optional parameters for the ContainerAppsPatchesClient.BeginApply +// method. +func (client *ContainerAppsPatchesClient) BeginApply(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *ContainerAppsPatchesClientBeginApplyOptions) (*runtime.Poller[ContainerAppsPatchesClientApplyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.apply(ctx, resourceGroupName, containerAppName, patchName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsPatchesClientApplyResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainerAppsPatchesClientApplyResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.applyCreateRequest(ctx, resourceGroupName, containerAppName, patchName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// applyCreateRequest creates the Apply request. +func (client *ContainerAppsPatchesClient) applyCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *ContainerAppsPatchesClientBeginApplyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/apply" + 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 patchName == "" { + return nil, errors.New("parameter patchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{patchName}", url.PathEscape(patchName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 +// - 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 +// - options - ContainerAppsPatchesClientBeginDeleteOptions contains the optional parameters for the ContainerAppsPatchesClient.BeginDelete +// method. +func (client *ContainerAppsPatchesClient) BeginDelete(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *ContainerAppsPatchesClientBeginDeleteOptions) (*runtime.Poller[ContainerAppsPatchesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, containerAppName, patchName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsPatchesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainerAppsPatchesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, containerAppName, patchName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContainerAppsPatchesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *ContainerAppsPatchesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}" + 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 patchName == "" { + return nil, errors.New("parameter patchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{patchName}", url.PathEscape(patchName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 +// - 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 +// - options - ContainerAppsPatchesClientGetOptions contains the optional parameters for the ContainerAppsPatchesClient.Get +// method. +func (client *ContainerAppsPatchesClient) Get(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *ContainerAppsPatchesClientGetOptions) (ContainerAppsPatchesClientGetResponse, error) { + var err error + const operationName = "ContainerAppsPatchesClient.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, containerAppName, patchName, options) + if err != nil { + return ContainerAppsPatchesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsPatchesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ContainerAppsPatchesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ContainerAppsPatchesClient) getCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *ContainerAppsPatchesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}" + 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 patchName == "" { + return nil, errors.New("parameter patchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{patchName}", url.PathEscape(patchName)) + 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-08-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 *ContainerAppsPatchesClient) getHandleResponse(resp *http.Response) (ContainerAppsPatchesClientGetResponse, error) { + result := ContainerAppsPatchesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ContainerAppsPatchResource); err != nil { + return ContainerAppsPatchesClientGetResponse{}, err + } + return result, nil +} + +// NewListByContainerAppPager - List Container Apps Patch resources by ContainerApp. +// +// Generated from API version 2024-08-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 +// method. +func (client *ContainerAppsPatchesClient) NewListByContainerAppPager(resourceGroupName string, containerAppName string, options *ContainerAppsPatchesClientListByContainerAppOptions) *runtime.Pager[ContainerAppsPatchesClientListByContainerAppResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsPatchesClientListByContainerAppResponse]{ + More: func(page ContainerAppsPatchesClientListByContainerAppResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsPatchesClientListByContainerAppResponse) (ContainerAppsPatchesClientListByContainerAppResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainerAppsPatchesClient.NewListByContainerAppPager") + 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.listByContainerAppCreateRequest(ctx, resourceGroupName, containerAppName, options) + }, nil) + if err != nil { + return ContainerAppsPatchesClientListByContainerAppResponse{}, err + } + return client.listByContainerAppHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByContainerAppCreateRequest creates the ListByContainerApp request. +func (client *ContainerAppsPatchesClient) listByContainerAppCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, options *ContainerAppsPatchesClientListByContainerAppOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches" + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByContainerAppHandleResponse handles the ListByContainerApp response. +func (client *ContainerAppsPatchesClient) listByContainerAppHandleResponse(resp *http.Response) (ContainerAppsPatchesClientListByContainerAppResponse, error) { + result := ContainerAppsPatchesClientListByContainerAppResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PatchCollection); err != nil { + return ContainerAppsPatchesClientListByContainerAppResponse{}, err + } + return result, nil +} + +// 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 +// - 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 +// - patchSkipConfig - Configure patcher to skip a patch or not. +// - options - ContainerAppsPatchesClientBeginSkipConfigureOptions contains the optional parameters for the ContainerAppsPatchesClient.BeginSkipConfigure +// method. +func (client *ContainerAppsPatchesClient) BeginSkipConfigure(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, patchSkipConfig PatchSkipConfig, options *ContainerAppsPatchesClientBeginSkipConfigureOptions) (*runtime.Poller[ContainerAppsPatchesClientSkipConfigureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.skipConfigure(ctx, resourceGroupName, containerAppName, patchName, patchSkipConfig, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsPatchesClientSkipConfigureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainerAppsPatchesClientSkipConfigureResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.skipConfigureCreateRequest(ctx, resourceGroupName, containerAppName, patchName, patchSkipConfig, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// skipConfigureCreateRequest creates the SkipConfigure request. +func (client *ContainerAppsPatchesClient) skipConfigureCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, patchSkipConfig PatchSkipConfig, options *ContainerAppsPatchesClientBeginSkipConfigureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/skipConfig" + 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 patchName == "" { + return nil, errors.New("parameter patchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{patchName}", url.PathEscape(patchName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, patchSkipConfig); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client_example_test.go new file mode 100644 index 0000000000..7ed73eaeb5 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappspatches_client_example_test.go @@ -0,0 +1,281 @@ +//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 f491815a64..726e985b3b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ContainerAppsRevisionReplicasClient struct { } // NewContainerAppsRevisionReplicasClient creates a new instance of ContainerAppsRevisionReplicasClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewContainerAppsRevisionReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsRevisionReplicasClient, error) { @@ -46,7 +47,7 @@ func NewContainerAppsRevisionReplicasClient(subscriptionID string, credential az // GetReplica - Get a replica for a Container App Revision. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -103,7 +104,7 @@ func (client *ContainerAppsRevisionReplicasClient) getReplicaCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,7 +122,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-03-01 +// Generated from API version 2024-08-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. @@ -173,7 +174,7 @@ func (client *ContainerAppsRevisionReplicasClient) listReplicasCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 96072e24f5..06a5f2a15b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisionreplicas_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Replicas_Get.json +// 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 { @@ -44,6 +44,7 @@ func ExampleContainerAppsRevisionReplicasClient_GetReplica() { // { // 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), @@ -61,7 +62,7 @@ func ExampleContainerAppsRevisionReplicasClient_GetReplica() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Replicas_List.json +// 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 { @@ -90,6 +91,7 @@ func ExampleContainerAppsRevisionReplicasClient_ListReplicas() { // { // 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), diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go index 52e185e2db..e2339f64e1 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ContainerAppsRevisionsClient struct { } // NewContainerAppsRevisionsClient creates a new instance of ContainerAppsRevisionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewContainerAppsRevisionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsRevisionsClient, error) { @@ -46,7 +47,7 @@ func NewContainerAppsRevisionsClient(subscriptionID string, credential azcore.To // ActivateRevision - Activates a revision for a Container App // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -97,7 +98,7 @@ func (client *ContainerAppsRevisionsClient) activateRevisionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,7 +107,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-03-01 +// Generated from API version 2024-08-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. @@ -157,7 +158,7 @@ func (client *ContainerAppsRevisionsClient) deactivateRevisionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -166,7 +167,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-03-01 +// Generated from API version 2024-08-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. @@ -218,7 +219,7 @@ func (client *ContainerAppsRevisionsClient) getRevisionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +236,7 @@ func (client *ContainerAppsRevisionsClient) getRevisionHandleResponse(resp *http // NewListRevisionsPager - Get the Revisions for a given Container App. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -286,7 +287,7 @@ func (client *ContainerAppsRevisionsClient) listRevisionsCreateRequest(ctx conte if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -304,7 +305,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-03-01 +// Generated from API version 2024-08-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. @@ -355,7 +356,7 @@ func (client *ContainerAppsRevisionsClient) restartRevisionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index c51f762158..44bf2f6ccc 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappsrevisions_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_List.json +// 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 { @@ -82,7 +82,7 @@ func ExampleContainerAppsRevisionsClient_NewListRevisionsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Get.json +// 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 { @@ -103,7 +103,7 @@ func ExampleContainerAppsRevisionsClient_GetRevision() { // res.Revision = armappcontainers.Revision{ // Name: to.Ptr("testcontainerApp0-pjxhsye"), // Type: to.Ptr("Microsoft.App/containerApps/revisions"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppcontainerApps/testcontainerApp0/revisions/testcontainerApp0-pjxhsye"), + // 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}()), @@ -140,7 +140,7 @@ func ExampleContainerAppsRevisionsClient_GetRevision() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Activate.json +// 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 { @@ -157,7 +157,7 @@ func ExampleContainerAppsRevisionsClient_ActivateRevision() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Deactivate.json +// 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 { @@ -174,7 +174,7 @@ func ExampleContainerAppsRevisionsClient_DeactivateRevision() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Restart.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client.go new file mode 100644 index 0000000000..2204ef0283 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client.go @@ -0,0 +1,464 @@ +//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" + "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" +) + +// ContainerAppsSessionPoolsClient contains the methods for the ContainerAppsSessionPools group. +// Don't use this type directly, use NewContainerAppsSessionPoolsClient() instead. +type ContainerAppsSessionPoolsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContainerAppsSessionPoolsClient creates a new instance of ContainerAppsSessionPoolsClient 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 NewContainerAppsSessionPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsSessionPoolsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContainerAppsSessionPoolsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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 +// - options - ContainerAppsSessionPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.BeginCreateOrUpdate +// method. +func (client *ContainerAppsSessionPoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, sessionPoolName string, sessionPoolEnvelope SessionPool, options *ContainerAppsSessionPoolsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ContainerAppsSessionPoolsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, sessionPoolName, sessionPoolEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsSessionPoolsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainerAppsSessionPoolsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, sessionPoolName, sessionPoolEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ContainerAppsSessionPoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, sessionPoolName string, sessionPoolEnvelope SessionPool, options *ContainerAppsSessionPoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}" + 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 sessionPoolName == "" { + return nil, errors.New("parameter sessionPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sessionPoolName}", url.PathEscape(sessionPoolName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, sessionPoolEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// 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 +// - 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 +// method. +func (client *ContainerAppsSessionPoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, sessionPoolName string, options *ContainerAppsSessionPoolsClientBeginDeleteOptions) (*runtime.Poller[ContainerAppsSessionPoolsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, sessionPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsSessionPoolsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainerAppsSessionPoolsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +func (client *ContainerAppsSessionPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, sessionPoolName string, options *ContainerAppsSessionPoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ContainerAppsSessionPoolsClient.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, sessionPoolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContainerAppsSessionPoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sessionPoolName string, options *ContainerAppsSessionPoolsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}" + 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 sessionPoolName == "" { + return nil, errors.New("parameter sessionPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sessionPoolName}", url.PathEscape(sessionPoolName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 +// - 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 +// method. +func (client *ContainerAppsSessionPoolsClient) Get(ctx context.Context, resourceGroupName string, sessionPoolName string, options *ContainerAppsSessionPoolsClientGetOptions) (ContainerAppsSessionPoolsClientGetResponse, error) { + var err error + const operationName = "ContainerAppsSessionPoolsClient.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, sessionPoolName, options) + if err != nil { + return ContainerAppsSessionPoolsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContainerAppsSessionPoolsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ContainerAppsSessionPoolsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ContainerAppsSessionPoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, sessionPoolName string, options *ContainerAppsSessionPoolsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}" + 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 sessionPoolName == "" { + return nil, errors.New("parameter sessionPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sessionPoolName}", url.PathEscape(sessionPoolName)) + 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-08-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 *ContainerAppsSessionPoolsClient) getHandleResponse(resp *http.Response) (ContainerAppsSessionPoolsClientGetResponse, error) { + result := ContainerAppsSessionPoolsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SessionPool); err != nil { + return ContainerAppsSessionPoolsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get the session pools in a given resource group of a subscription. +// +// Generated from API version 2024-08-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. +func (client *ContainerAppsSessionPoolsClient) NewListByResourceGroupPager(resourceGroupName string, options *ContainerAppsSessionPoolsClientListByResourceGroupOptions) *runtime.Pager[ContainerAppsSessionPoolsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsSessionPoolsClientListByResourceGroupResponse]{ + More: func(page ContainerAppsSessionPoolsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsSessionPoolsClientListByResourceGroupResponse) (ContainerAppsSessionPoolsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainerAppsSessionPoolsClient.NewListByResourceGroupPager") + 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.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ContainerAppsSessionPoolsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ContainerAppsSessionPoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ContainerAppsSessionPoolsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ContainerAppsSessionPoolsClient) listByResourceGroupHandleResponse(resp *http.Response) (ContainerAppsSessionPoolsClientListByResourceGroupResponse, error) { + result := ContainerAppsSessionPoolsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SessionPoolCollection); err != nil { + return ContainerAppsSessionPoolsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get the session pools in a given subscription. +// +// Generated from API version 2024-08-02-preview +// - options - ContainerAppsSessionPoolsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.NewListBySubscriptionPager +// method. +func (client *ContainerAppsSessionPoolsClient) NewListBySubscriptionPager(options *ContainerAppsSessionPoolsClientListBySubscriptionOptions) *runtime.Pager[ContainerAppsSessionPoolsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ContainerAppsSessionPoolsClientListBySubscriptionResponse]{ + More: func(page ContainerAppsSessionPoolsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContainerAppsSessionPoolsClientListBySubscriptionResponse) (ContainerAppsSessionPoolsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainerAppsSessionPoolsClient.NewListBySubscriptionPager") + 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.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return ContainerAppsSessionPoolsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ContainerAppsSessionPoolsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ContainerAppsSessionPoolsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.App/sessionPools" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ContainerAppsSessionPoolsClient) listBySubscriptionHandleResponse(resp *http.Response) (ContainerAppsSessionPoolsClientListBySubscriptionResponse, error) { + result := ContainerAppsSessionPoolsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SessionPoolCollection); err != nil { + return ContainerAppsSessionPoolsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// 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 +// - 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 +// - options - ContainerAppsSessionPoolsClientBeginUpdateOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.BeginUpdate +// method. +func (client *ContainerAppsSessionPoolsClient) BeginUpdate(ctx context.Context, resourceGroupName string, sessionPoolName string, sessionPoolEnvelope SessionPoolUpdatableProperties, options *ContainerAppsSessionPoolsClientBeginUpdateOptions) (*runtime.Poller[ContainerAppsSessionPoolsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, sessionPoolName, sessionPoolEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainerAppsSessionPoolsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainerAppsSessionPoolsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, sessionPoolName, sessionPoolEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ContainerAppsSessionPoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sessionPoolName string, sessionPoolEnvelope SessionPoolUpdatableProperties, options *ContainerAppsSessionPoolsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}" + 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 sessionPoolName == "" { + return nil, errors.New("parameter sessionPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sessionPoolName}", url.PathEscape(sessionPoolName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, sessionPoolEnvelope); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client_example_test.go new file mode 100644 index 0000000000..bf3bd839e0 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssessionpools_client_example_test.go @@ -0,0 +1,462 @@ +//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 bdc5f15e27..e27a1e89b4 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client.go @@ -11,13 +11,15 @@ 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" - "strings" ) // ContainerAppsSourceControlsClient contains the methods for the ContainerAppsSourceControls group. @@ -28,7 +30,7 @@ type ContainerAppsSourceControlsClient struct { } // NewContainerAppsSourceControlsClient creates a new instance of ContainerAppsSourceControlsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewContainerAppsSourceControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerAppsSourceControlsClient, error) { @@ -46,7 +48,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-03-01 +// Generated from API version 2024-08-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. @@ -73,7 +75,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-03-01 +// Generated from API version 2024-08-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" @@ -119,9 +121,12 @@ func (client *ContainerAppsSourceControlsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.XMSGithubAuxiliary != nil { + req.Raw().Header["x-ms-github-auxiliary"] = []string{*options.XMSGithubAuxiliary} + } if err := runtime.MarshalAsJSON(req, sourceControlEnvelope); err != nil { return nil, err } @@ -131,7 +136,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-03-01 +// Generated from API version 2024-08-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. @@ -157,7 +162,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-03-01 +// Generated from API version 2024-08-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" @@ -203,16 +208,25 @@ func (client *ContainerAppsSourceControlsClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") + if options != nil && options.DeleteWorkflow != nil { + reqQP.Set("deleteWorkflow", strconv.FormatBool(*options.DeleteWorkflow)) + } + if options != nil && options.IgnoreWorkflowDeletionFailure != nil { + reqQP.Set("ignoreWorkflowDeletionFailure", strconv.FormatBool(*options.IgnoreWorkflowDeletionFailure)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.XMSGithubAuxiliary != nil { + req.Raw().Header["x-ms-github-auxiliary"] = []string{*options.XMSGithubAuxiliary} + } return req, nil } // Get - Get a SourceControl of a Container App. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -264,7 +278,7 @@ func (client *ContainerAppsSourceControlsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +295,7 @@ func (client *ContainerAppsSourceControlsClient) getHandleResponse(resp *http.Re // NewListByContainerAppPager - Get the Container App SourceControls in a given resource group. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -329,7 +343,7 @@ func (client *ContainerAppsSourceControlsClient) listByContainerAppCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 81fd3b5cbf..995b12e24d 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/containerappssourcecontrols_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_ListByContainer.json +// 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 { @@ -49,7 +49,17 @@ func ExampleContainerAppsSourceControlsClient_NewListByContainerAppPager() { // 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"), @@ -63,7 +73,7 @@ func ExampleContainerAppsSourceControlsClient_NewListByContainerAppPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_Get.json +// 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 { @@ -88,7 +98,17 @@ func ExampleContainerAppsSourceControlsClient_Get() { // 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"), @@ -100,7 +120,7 @@ func ExampleContainerAppsSourceControlsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_CreateOrUpdate.json +// 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 { @@ -121,7 +141,17 @@ func ExampleContainerAppsSourceControlsClient_BeginCreateOrUpdate() { 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{ @@ -132,7 +162,7 @@ func ExampleContainerAppsSourceControlsClient_BeginCreateOrUpdate() { }, RepoURL: to.Ptr("https://github.com/xwang971/ghatest"), }, - }, nil) + }, &armappcontainers.ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions{XMSGithubAuxiliary: to.Ptr("githubaccesstoken")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -150,6 +180,15 @@ func ExampleContainerAppsSourceControlsClient_BeginCreateOrUpdate() { // 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{ @@ -163,7 +202,7 @@ func ExampleContainerAppsSourceControlsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_Delete.json +// 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 { @@ -174,7 +213,10 @@ func ExampleContainerAppsSourceControlsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewContainerAppsSourceControlsClient().BeginDelete(ctx, "workerapps-rg-xj", "testcanadacentral", "current", nil) + 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) } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client.go new file mode 100644 index 0000000000..ab0614011f --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client.go @@ -0,0 +1,334 @@ +//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" + "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" +) + +// DaprComponentResiliencyPoliciesClient contains the methods for the DaprComponentResiliencyPolicies group. +// Don't use this type directly, use NewDaprComponentResiliencyPoliciesClient() instead. +type DaprComponentResiliencyPoliciesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDaprComponentResiliencyPoliciesClient creates a new instance of DaprComponentResiliencyPoliciesClient 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 NewDaprComponentResiliencyPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DaprComponentResiliencyPoliciesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DaprComponentResiliencyPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - componentName - Name of the Dapr Component. +// - name - Name of the Dapr Component Resiliency Policy. +// - daprComponentResiliencyPolicyEnvelope - Configuration details of the Dapr Component Resiliency Policy. +// - options - DaprComponentResiliencyPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DaprComponentResiliencyPoliciesClient.CreateOrUpdate +// method. +func (client *DaprComponentResiliencyPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, daprComponentResiliencyPolicyEnvelope DaprComponentResiliencyPolicy, options *DaprComponentResiliencyPoliciesClientCreateOrUpdateOptions) (DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse, error) { + var err error + const operationName = "DaprComponentResiliencyPoliciesClient.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, componentName, name, daprComponentResiliencyPolicyEnvelope, options) + if err != nil { + return DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DaprComponentResiliencyPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, daprComponentResiliencyPolicyEnvelope DaprComponentResiliencyPolicy, options *DaprComponentResiliencyPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, daprComponentResiliencyPolicyEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DaprComponentResiliencyPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse, error) { + result := DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponentResiliencyPolicy); err != nil { + return DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - componentName - Name of the Dapr Component. +// - name - Name of the Dapr Component Resiliency Policy. +// - options - DaprComponentResiliencyPoliciesClientDeleteOptions contains the optional parameters for the DaprComponentResiliencyPoliciesClient.Delete +// method. +func (client *DaprComponentResiliencyPoliciesClient) Delete(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, options *DaprComponentResiliencyPoliciesClientDeleteOptions) (DaprComponentResiliencyPoliciesClientDeleteResponse, error) { + var err error + const operationName = "DaprComponentResiliencyPoliciesClient.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, componentName, name, options) + if err != nil { + return DaprComponentResiliencyPoliciesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DaprComponentResiliencyPoliciesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DaprComponentResiliencyPoliciesClientDeleteResponse{}, err + } + return DaprComponentResiliencyPoliciesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DaprComponentResiliencyPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, options *DaprComponentResiliencyPoliciesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - componentName - Name of the Dapr Component. +// - name - Name of the Dapr Component Resiliency Policy. +// - options - DaprComponentResiliencyPoliciesClientGetOptions contains the optional parameters for the DaprComponentResiliencyPoliciesClient.Get +// method. +func (client *DaprComponentResiliencyPoliciesClient) Get(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, options *DaprComponentResiliencyPoliciesClientGetOptions) (DaprComponentResiliencyPoliciesClientGetResponse, error) { + var err error + const operationName = "DaprComponentResiliencyPoliciesClient.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, componentName, name, options) + if err != nil { + return DaprComponentResiliencyPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DaprComponentResiliencyPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DaprComponentResiliencyPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DaprComponentResiliencyPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, options *DaprComponentResiliencyPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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 *DaprComponentResiliencyPoliciesClient) getHandleResponse(resp *http.Response) (DaprComponentResiliencyPoliciesClientGetResponse, error) { + result := DaprComponentResiliencyPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponentResiliencyPolicy); err != nil { + return DaprComponentResiliencyPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the resiliency policies for a Dapr component. +// +// Generated from API version 2024-08-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. +// - options - DaprComponentResiliencyPoliciesClientListOptions contains the optional parameters for the DaprComponentResiliencyPoliciesClient.NewListPager +// method. +func (client *DaprComponentResiliencyPoliciesClient) NewListPager(resourceGroupName string, environmentName string, componentName string, options *DaprComponentResiliencyPoliciesClientListOptions) *runtime.Pager[DaprComponentResiliencyPoliciesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DaprComponentResiliencyPoliciesClientListResponse]{ + More: func(page DaprComponentResiliencyPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DaprComponentResiliencyPoliciesClientListResponse) (DaprComponentResiliencyPoliciesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DaprComponentResiliencyPoliciesClient.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, componentName, options) + }, nil) + if err != nil { + return DaprComponentResiliencyPoliciesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *DaprComponentResiliencyPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, componentName string, options *DaprComponentResiliencyPoliciesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if componentName == "" { + return nil, errors.New("parameter componentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{componentName}", url.PathEscape(componentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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 *DaprComponentResiliencyPoliciesClient) listHandleResponse(resp *http.Response) (DaprComponentResiliencyPoliciesClientListResponse, error) { + result := DaprComponentResiliencyPoliciesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprComponentResiliencyPoliciesCollection); err != nil { + return DaprComponentResiliencyPoliciesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client_example_test.go new file mode 100644 index 0000000000..7f2a1dc56f --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponentresiliencypolicies_client_example_test.go @@ -0,0 +1,392 @@ +//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 9cc17c2e3d..f905bf710a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type DaprComponentsClient struct { } // NewDaprComponentsClient creates a new instance of DaprComponentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewDaprComponentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DaprComponentsClient, error) { @@ -46,7 +47,7 @@ func NewDaprComponentsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Creates or updates a Dapr Component in a Managed Environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -99,7 +100,7 @@ func (client *DaprComponentsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, daprComponentEnvelope); err != nil { @@ -120,7 +121,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-03-01 +// Generated from API version 2024-08-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. @@ -170,7 +171,7 @@ func (client *DaprComponentsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +180,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-03-01 +// Generated from API version 2024-08-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. @@ -230,7 +231,7 @@ func (client *DaprComponentsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,7 +248,7 @@ func (client *DaprComponentsClient) getHandleResponse(resp *http.Response) (Dapr // NewListPager - Get the Dapr Components for a managed environment. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -294,7 +295,7 @@ func (client *DaprComponentsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -312,7 +313,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-03-01 +// Generated from API version 2024-08-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. @@ -364,7 +365,7 @@ func (client *DaprComponentsClient) listSecretsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index aeeaf4c27f..a2492bb029 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprcomponents_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_List.json +// 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 { @@ -74,6 +74,15 @@ func ExampleDaprComponentsClient_NewListPager() { // { // 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"), // }, // }, @@ -106,6 +115,15 @@ func ExampleDaprComponentsClient_NewListPager() { // 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"), // }, // }, @@ -138,6 +156,15 @@ func ExampleDaprComponentsClient_NewListPager() { // 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"), // }, // }}, @@ -145,7 +172,7 @@ func ExampleDaprComponentsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Get_SecretStoreComponent.json +// 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 { @@ -192,12 +219,21 @@ func ExampleDaprComponentsClient_Get_getDaprComponentWithSecretStoreComponent() // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Get_Secrets.json +// 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 { @@ -247,12 +283,21 @@ func ExampleDaprComponentsClient_Get_getDaprComponentWithSecrets() { // { // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +// 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 { @@ -289,7 +334,16 @@ func ExampleDaprComponentsClient_CreateOrUpdate_createOrUpdateDaprComponentWithS to.Ptr("container-app-1"), to.Ptr("container-app-2")}, SecretStoreComponent: to.Ptr("my-secret-store"), - Version: to.Ptr("v1"), + 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 { @@ -327,12 +381,21 @@ func ExampleDaprComponentsClient_CreateOrUpdate_createOrUpdateDaprComponentWithS // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_CreateOrUpdate_Secrets.json +// 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 { @@ -373,6 +436,15 @@ func ExampleDaprComponentsClient_CreateOrUpdate_createOrUpdateDaprComponentWithS 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) @@ -414,12 +486,21 @@ func ExampleDaprComponentsClient_CreateOrUpdate_createOrUpdateDaprComponentWithS // { // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Delete.json +// 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 { @@ -436,7 +517,7 @@ func ExampleDaprComponentsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_ListSecrets.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client.go new file mode 100644 index 0000000000..49eb6d46fb --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_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" + "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" +) + +// DaprSubscriptionsClient contains the methods for the DaprSubscriptions group. +// Don't use this type directly, use NewDaprSubscriptionsClient() instead. +type DaprSubscriptionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDaprSubscriptionsClient creates a new instance of DaprSubscriptionsClient 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 NewDaprSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DaprSubscriptionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DaprSubscriptionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - name - Name of the Dapr subscription. +// - daprSubscriptionEnvelope - Configuration details of the Dapr subscription. +// - options - DaprSubscriptionsClientCreateOrUpdateOptions contains the optional parameters for the DaprSubscriptionsClient.CreateOrUpdate +// method. +func (client *DaprSubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, name string, daprSubscriptionEnvelope DaprSubscription, options *DaprSubscriptionsClientCreateOrUpdateOptions) (DaprSubscriptionsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "DaprSubscriptionsClient.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, name, daprSubscriptionEnvelope, options) + if err != nil { + return DaprSubscriptionsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DaprSubscriptionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DaprSubscriptionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DaprSubscriptionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, daprSubscriptionEnvelope DaprSubscription, options *DaprSubscriptionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, daprSubscriptionEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DaprSubscriptionsClient) createOrUpdateHandleResponse(resp *http.Response) (DaprSubscriptionsClientCreateOrUpdateResponse, error) { + result := DaprSubscriptionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprSubscription); err != nil { + return DaprSubscriptionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - name - Name of the Dapr subscription. +// - options - DaprSubscriptionsClientDeleteOptions contains the optional parameters for the DaprSubscriptionsClient.Delete +// method. +func (client *DaprSubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DaprSubscriptionsClientDeleteOptions) (DaprSubscriptionsClientDeleteResponse, error) { + var err error + const operationName = "DaprSubscriptionsClient.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, name, options) + if err != nil { + return DaprSubscriptionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DaprSubscriptionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DaprSubscriptionsClientDeleteResponse{}, err + } + return DaprSubscriptionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DaprSubscriptionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DaprSubscriptionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a dapr subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - DaprSubscriptionsClientGetOptions contains the optional parameters for the DaprSubscriptionsClient.Get method. +func (client *DaprSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DaprSubscriptionsClientGetOptions) (DaprSubscriptionsClientGetResponse, error) { + var err error + const operationName = "DaprSubscriptionsClient.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, name, options) + if err != nil { + return DaprSubscriptionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DaprSubscriptionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DaprSubscriptionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DaprSubscriptionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DaprSubscriptionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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 *DaprSubscriptionsClient) getHandleResponse(resp *http.Response) (DaprSubscriptionsClientGetResponse, error) { + result := DaprSubscriptionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprSubscription); err != nil { + return DaprSubscriptionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Dapr subscriptions for a managed environment. +// +// Generated from API version 2024-08-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 +// method. +func (client *DaprSubscriptionsClient) NewListPager(resourceGroupName string, environmentName string, options *DaprSubscriptionsClientListOptions) *runtime.Pager[DaprSubscriptionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DaprSubscriptionsClientListResponse]{ + More: func(page DaprSubscriptionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DaprSubscriptionsClientListResponse) (DaprSubscriptionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DaprSubscriptionsClient.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 DaprSubscriptionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *DaprSubscriptionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *DaprSubscriptionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions" + 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-08-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 *DaprSubscriptionsClient) listHandleResponse(resp *http.Response) (DaprSubscriptionsClientListResponse, error) { + result := DaprSubscriptionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DaprSubscriptionsCollection); err != nil { + return DaprSubscriptionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client_example_test.go new file mode 100644 index 0000000000..d239bcd257 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/daprsubscriptions_client_example_test.go @@ -0,0 +1,409 @@ +//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 new file mode 100644 index 0000000000..60bc84ac5f --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client.go @@ -0,0 +1,432 @@ +//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" + "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" +) + +// DotNetComponentsClient contains the methods for the DotNetComponents group. +// Don't use this type directly, use NewDotNetComponentsClient() instead. +type DotNetComponentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDotNetComponentsClient creates a new instance of DotNetComponentsClient 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 NewDotNetComponentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DotNetComponentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DotNetComponentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - name - Name of the .NET Component. +// - dotNetComponentEnvelope - Configuration details of the .NET Component. +// - options - DotNetComponentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DotNetComponentsClient.BeginCreateOrUpdate +// method. +func (client *DotNetComponentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, name string, dotNetComponentEnvelope DotNetComponent, options *DotNetComponentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DotNetComponentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, environmentName, name, dotNetComponentEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DotNetComponentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DotNetComponentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, name, dotNetComponentEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DotNetComponentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, dotNetComponentEnvelope DotNetComponent, options *DotNetComponentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, dotNetComponentEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a .NET Component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - DotNetComponentsClientBeginDeleteOptions contains the optional parameters for the DotNetComponentsClient.BeginDelete +// method. +func (client *DotNetComponentsClient) BeginDelete(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DotNetComponentsClientBeginDeleteOptions) (*runtime.Poller[DotNetComponentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, environmentName, name, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DotNetComponentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DotNetComponentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a .NET Component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + 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, name, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DotNetComponentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DotNetComponentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a .NET Component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - DotNetComponentsClientGetOptions contains the optional parameters for the DotNetComponentsClient.Get method. +func (client *DotNetComponentsClient) Get(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DotNetComponentsClientGetOptions) (DotNetComponentsClientGetResponse, error) { + var err error + const operationName = "DotNetComponentsClient.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, name, options) + if err != nil { + return DotNetComponentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DotNetComponentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DotNetComponentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DotNetComponentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, options *DotNetComponentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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 *DotNetComponentsClient) getHandleResponse(resp *http.Response) (DotNetComponentsClientGetResponse, error) { + result := DotNetComponentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DotNetComponent); err != nil { + return DotNetComponentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the .NET Components for a managed environment. +// +// Generated from API version 2024-08-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 +// method. +func (client *DotNetComponentsClient) NewListPager(resourceGroupName string, environmentName string, options *DotNetComponentsClientListOptions) *runtime.Pager[DotNetComponentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DotNetComponentsClientListResponse]{ + More: func(page DotNetComponentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DotNetComponentsClientListResponse) (DotNetComponentsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DotNetComponentsClient.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 DotNetComponentsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *DotNetComponentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *DotNetComponentsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents" + 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-08-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 *DotNetComponentsClient) listHandleResponse(resp *http.Response) (DotNetComponentsClientListResponse, error) { + result := DotNetComponentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DotNetComponentsCollection); err != nil { + return DotNetComponentsClientListResponse{}, err + } + return result, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - name - Name of the .NET Component. +// - dotNetComponentEnvelope - Configuration details of the .NET Component. +// - options - DotNetComponentsClientBeginUpdateOptions contains the optional parameters for the DotNetComponentsClient.BeginUpdate +// method. +func (client *DotNetComponentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, environmentName string, name string, dotNetComponentEnvelope DotNetComponent, options *DotNetComponentsClientBeginUpdateOptions) (*runtime.Poller[DotNetComponentsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, environmentName, name, dotNetComponentEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DotNetComponentsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DotNetComponentsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, name, dotNetComponentEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DotNetComponentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, dotNetComponentEnvelope DotNetComponent, options *DotNetComponentsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, dotNetComponentEnvelope); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client_example_test.go new file mode 100644 index 0000000000..5feaf78c73 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/dotnetcomponents_client_example_test.go @@ -0,0 +1,443 @@ +//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 new file mode 100644 index 0000000000..3261255adf --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/appresiliency_server.go @@ -0,0 +1,294 @@ +//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" + "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" +) + +// AppResiliencyServer is a fake server for instances of the armappcontainers.AppResiliencyClient type. +type AppResiliencyServer struct { + // CreateOrUpdate is the fake for method AppResiliencyClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, appName string, name string, resiliencyEnvelope armappcontainers.AppResiliency, options *armappcontainers.AppResiliencyClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.AppResiliencyClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method AppResiliencyClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, appName string, name string, options *armappcontainers.AppResiliencyClientDeleteOptions) (resp azfake.Responder[armappcontainers.AppResiliencyClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AppResiliencyClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, appName string, name string, options *armappcontainers.AppResiliencyClientGetOptions) (resp azfake.Responder[armappcontainers.AppResiliencyClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AppResiliencyClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, appName string, options *armappcontainers.AppResiliencyClientListOptions) (resp azfake.PagerResponder[armappcontainers.AppResiliencyClientListResponse]) + + // Update is the fake for method AppResiliencyClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, appName string, name string, resiliencyEnvelope armappcontainers.AppResiliency, options *armappcontainers.AppResiliencyClientUpdateOptions) (resp azfake.Responder[armappcontainers.AppResiliencyClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewAppResiliencyServerTransport creates a new instance of AppResiliencyServerTransport with the provided implementation. +// The returned AppResiliencyServerTransport instance is connected to an instance of armappcontainers.AppResiliencyClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAppResiliencyServerTransport(srv *AppResiliencyServer) *AppResiliencyServerTransport { + return &AppResiliencyServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armappcontainers.AppResiliencyClientListResponse]](), + } +} + +// AppResiliencyServerTransport connects instances of armappcontainers.AppResiliencyClient to instances of AppResiliencyServer. +// Don't use this type directly, use NewAppResiliencyServerTransport instead. +type AppResiliencyServerTransport struct { + srv *AppResiliencyServer + newListPager *tracker[azfake.PagerResponder[armappcontainers.AppResiliencyClientListResponse]] +} + +// Do implements the policy.Transporter interface for AppResiliencyServerTransport. +func (a *AppResiliencyServerTransport) 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 "AppResiliencyClient.CreateOrUpdate": + resp, err = a.dispatchCreateOrUpdate(req) + case "AppResiliencyClient.Delete": + resp, err = a.dispatchDelete(req) + case "AppResiliencyClient.Get": + resp, err = a.dispatchGet(req) + case "AppResiliencyClient.NewListPager": + resp, err = a.dispatchNewListPager(req) + case "AppResiliencyClient.Update": + resp, err = a.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AppResiliencyServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?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.AppResiliency](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + appNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("appName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, appNameParam, nameParam, 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).AppResiliency, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AppResiliencyServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?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 + } + appNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("appName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, appNameParam, nameParam, 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 (a *AppResiliencyServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?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 + } + appNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("appName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, appNameParam, nameParam, 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).AppResiliency, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AppResiliencyServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies` + 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 + } + appNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("appName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListPager(resourceGroupNameParam, appNameParam, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.AppResiliencyClientListResponse, 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) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +func (a *AppResiliencyServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if a.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?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.AppResiliency](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + appNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("appName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, appNameParam, nameParam, 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).AppResiliency, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/availableworkloadprofiles_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/availableworkloadprofiles_server.go index 97e136b55c..b7e4276be2 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/availableworkloadprofiles_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/availableworkloadprofiles_server.go @@ -11,14 +11,15 @@ 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 c4043b6395..3ec8c1e13e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/billingmeters_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/billingmeters_server.go @@ -12,13 +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/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 new file mode 100644 index 0000000000..b78b5f9711 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildauthtoken_server.go @@ -0,0 +1,105 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +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" +) + +// BuildAuthTokenServer is a fake server for instances of the armappcontainers.BuildAuthTokenClient type. +type BuildAuthTokenServer struct { + // List is the fake for method BuildAuthTokenClient.List + // HTTP status codes to indicate success: http.StatusOK + List func(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *armappcontainers.BuildAuthTokenClientListOptions) (resp azfake.Responder[armappcontainers.BuildAuthTokenClientListResponse], errResp azfake.ErrorResponder) +} + +// NewBuildAuthTokenServerTransport creates a new instance of BuildAuthTokenServerTransport with the provided implementation. +// The returned BuildAuthTokenServerTransport instance is connected to an instance of armappcontainers.BuildAuthTokenClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBuildAuthTokenServerTransport(srv *BuildAuthTokenServer) *BuildAuthTokenServerTransport { + return &BuildAuthTokenServerTransport{srv: srv} +} + +// BuildAuthTokenServerTransport connects instances of armappcontainers.BuildAuthTokenClient to instances of BuildAuthTokenServer. +// Don't use this type directly, use NewBuildAuthTokenServerTransport instead. +type BuildAuthTokenServerTransport struct { + srv *BuildAuthTokenServer +} + +// Do implements the policy.Transporter interface for BuildAuthTokenServerTransport. +func (b *BuildAuthTokenServerTransport) 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 "BuildAuthTokenClient.List": + resp, err = b.dispatchList(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BuildAuthTokenServerTransport) dispatchList(req *http.Request) (*http.Response, error) { + if b.srv.List == nil { + return nil, &nonRetriableError{errors.New("fake for method List not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listAuthToken` + 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 + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.List(req.Context(), resourceGroupNameParam, builderNameParam, buildNameParam, 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).BuildToken, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/builders_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/builders_server.go new file mode 100644 index 0000000000..b87d6ed74f --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/builders_server.go @@ -0,0 +1,354 @@ +//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" + "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" +) + +// BuildersServer is a fake server for instances of the armappcontainers.BuildersClient type. +type BuildersServer struct { + // BeginCreateOrUpdate is the fake for method BuildersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, builderName string, builderEnvelope armappcontainers.BuilderResource, options *armappcontainers.BuildersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.BuildersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method BuildersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, builderName string, options *armappcontainers.BuildersClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.BuildersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method BuildersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, builderName string, options *armappcontainers.BuildersClientGetOptions) (resp azfake.Responder[armappcontainers.BuildersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method BuildersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armappcontainers.BuildersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armappcontainers.BuildersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method BuildersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armappcontainers.BuildersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armappcontainers.BuildersClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method BuildersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, builderName string, builderEnvelope armappcontainers.BuilderResourceUpdate, options *armappcontainers.BuildersClientBeginUpdateOptions) (resp azfake.PollerResponder[armappcontainers.BuildersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewBuildersServerTransport creates a new instance of BuildersServerTransport with the provided implementation. +// The returned BuildersServerTransport instance is connected to an instance of armappcontainers.BuildersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBuildersServerTransport(srv *BuildersServer) *BuildersServerTransport { + return &BuildersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.BuildersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.BuildersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armappcontainers.BuildersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armappcontainers.BuildersClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armappcontainers.BuildersClientUpdateResponse]](), + } +} + +// BuildersServerTransport connects instances of armappcontainers.BuildersClient to instances of BuildersServer. +// Don't use this type directly, use NewBuildersServerTransport instead. +type BuildersServerTransport struct { + srv *BuildersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.BuildersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.BuildersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armappcontainers.BuildersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armappcontainers.BuildersClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armappcontainers.BuildersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for BuildersServerTransport. +func (b *BuildersServerTransport) 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 "BuildersClient.BeginCreateOrUpdate": + resp, err = b.dispatchBeginCreateOrUpdate(req) + case "BuildersClient.BeginDelete": + resp, err = b.dispatchBeginDelete(req) + case "BuildersClient.Get": + resp, err = b.dispatchGet(req) + case "BuildersClient.NewListByResourceGroupPager": + resp, err = b.dispatchNewListByResourceGroupPager(req) + case "BuildersClient.NewListBySubscriptionPager": + resp, err = b.dispatchNewListBySubscriptionPager(req) + case "BuildersClient.BeginUpdate": + resp, err = b.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BuildersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if b.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := b.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.BuilderResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, builderNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + b.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + b.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + b.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (b *BuildersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if b.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := b.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginDelete(req.Context(), resourceGroupNameParam, builderNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + b.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + b.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + b.beginDelete.remove(req) + } + + return resp, nil +} + +func (b *BuildersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if b.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/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, builderNameParam, 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).BuilderResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (b *BuildersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if b.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := b.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + 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 + } + resp := b.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + b.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armappcontainers.BuildersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + b.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + b.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (b *BuildersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if b.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := b.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := b.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + b.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armappcontainers.BuildersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + b.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + b.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (b *BuildersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if b.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := b.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.BuilderResourceUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginUpdate(req.Context(), resourceGroupNameParam, builderNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + b.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + b.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + b.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/builds_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/builds_server.go new file mode 100644 index 0000000000..ca8cf5a384 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/builds_server.go @@ -0,0 +1,223 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +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" +) + +// BuildsServer is a fake server for instances of the armappcontainers.BuildsClient type. +type BuildsServer struct { + // BeginCreateOrUpdate is the fake for method BuildsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, builderName string, buildName string, buildEnvelope armappcontainers.BuildResource, options *armappcontainers.BuildsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.BuildsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method BuildsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *armappcontainers.BuildsClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.BuildsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method BuildsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, builderName string, buildName string, options *armappcontainers.BuildsClientGetOptions) (resp azfake.Responder[armappcontainers.BuildsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewBuildsServerTransport creates a new instance of BuildsServerTransport with the provided implementation. +// The returned BuildsServerTransport instance is connected to an instance of armappcontainers.BuildsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBuildsServerTransport(srv *BuildsServer) *BuildsServerTransport { + return &BuildsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.BuildsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.BuildsClientDeleteResponse]](), + } +} + +// BuildsServerTransport connects instances of armappcontainers.BuildsClient to instances of BuildsServer. +// Don't use this type directly, use NewBuildsServerTransport instead. +type BuildsServerTransport struct { + srv *BuildsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.BuildsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.BuildsClientDeleteResponse]] +} + +// Do implements the policy.Transporter interface for BuildsServerTransport. +func (b *BuildsServerTransport) 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 "BuildsClient.BeginCreateOrUpdate": + resp, err = b.dispatchBeginCreateOrUpdate(req) + case "BuildsClient.BeginDelete": + resp, err = b.dispatchBeginDelete(req) + case "BuildsClient.Get": + resp, err = b.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BuildsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if b.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := b.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?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.BuildResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, builderNameParam, buildNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + b.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + b.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + b.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (b *BuildsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if b.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := b.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?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 + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginDelete(req.Context(), resourceGroupNameParam, builderNameParam, buildNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + b.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + b.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + b.beginDelete.remove(req) + } + + return resp, nil +} + +func (b *BuildsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if b.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/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?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 + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, builderNameParam, buildNameParam, 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).BuildResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildsbybuilderresource_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildsbybuilderresource_server.go new file mode 100644 index 0000000000..abe6a8fd07 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/buildsbybuilderresource_server.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// BuildsByBuilderResourceServer is a fake server for instances of the armappcontainers.BuildsByBuilderResourceClient type. +type BuildsByBuilderResourceServer struct { + // NewListPager is the fake for method BuildsByBuilderResourceClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, builderName string, options *armappcontainers.BuildsByBuilderResourceClientListOptions) (resp azfake.PagerResponder[armappcontainers.BuildsByBuilderResourceClientListResponse]) +} + +// NewBuildsByBuilderResourceServerTransport creates a new instance of BuildsByBuilderResourceServerTransport with the provided implementation. +// The returned BuildsByBuilderResourceServerTransport instance is connected to an instance of armappcontainers.BuildsByBuilderResourceClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBuildsByBuilderResourceServerTransport(srv *BuildsByBuilderResourceServer) *BuildsByBuilderResourceServerTransport { + return &BuildsByBuilderResourceServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armappcontainers.BuildsByBuilderResourceClientListResponse]](), + } +} + +// BuildsByBuilderResourceServerTransport connects instances of armappcontainers.BuildsByBuilderResourceClient to instances of BuildsByBuilderResourceServer. +// Don't use this type directly, use NewBuildsByBuilderResourceServerTransport instead. +type BuildsByBuilderResourceServerTransport struct { + srv *BuildsByBuilderResourceServer + newListPager *tracker[azfake.PagerResponder[armappcontainers.BuildsByBuilderResourceClientListResponse]] +} + +// Do implements the policy.Transporter interface for BuildsByBuilderResourceServerTransport. +func (b *BuildsByBuilderResourceServerTransport) 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 "BuildsByBuilderResourceClient.NewListPager": + resp, err = b.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BuildsByBuilderResourceServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if b.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := b.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds` + 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 + } + builderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("builderName")]) + if err != nil { + return nil, err + } + resp := b.srv.NewListPager(resourceGroupNameParam, builderNameParam, nil) + newListPager = &resp + b.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.BuildsByBuilderResourceClientListResponse, 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) { + b.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + b.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/certificates_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/certificates_server.go index bf03f93f8f..3ca540fff5 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/certificates_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/certificates_server.go @@ -12,15 +12,16 @@ 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 0373828e41..3502eb18a3 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironments_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironments_server.go @@ -12,14 +12,15 @@ 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 4c48815fd5..8d6c858ff0 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentscertificates_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentscertificates_server.go @@ -12,15 +12,16 @@ 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. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsdaprcomponents_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsdaprcomponents_server.go index 109760712e..26fa054b17 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsdaprcomponents_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsdaprcomponents_server.go @@ -12,14 +12,15 @@ 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. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsstorages_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsstorages_server.go index 0a4c9802a3..87a61a5c29 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsstorages_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/connectedenvironmentsstorages_server.go @@ -12,13 +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/resourcemanager/appcontainers/armappcontainers/v3" - "net/http" - "net/url" - "regexp" ) // ConnectedEnvironmentsStoragesServer is a fake server for instances of the armappcontainers.ConnectedEnvironmentsStoragesClient type. diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerapps_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerapps_server.go index dce2e07f26..66764ff847 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerapps_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerapps_server.go @@ -12,14 +12,15 @@ 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 43d56f17d7..84cf870fcb 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsapi_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsapi_server.go @@ -12,13 +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/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 5eb1a3c7da..31ff382f8d 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsauthconfigs_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsauthconfigs_server.go @@ -12,14 +12,15 @@ 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 new file mode 100644 index 0000000000..38f0954295 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuilds_server.go @@ -0,0 +1,163 @@ +//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" + "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" +) + +// ContainerAppsBuildsServer is a fake server for instances of the armappcontainers.ContainerAppsBuildsClient type. +type ContainerAppsBuildsServer struct { + // BeginDelete is the fake for method ContainerAppsBuildsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, containerAppName string, buildName string, options *armappcontainers.ContainerAppsBuildsClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.ContainerAppsBuildsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ContainerAppsBuildsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, containerAppName string, buildName string, options *armappcontainers.ContainerAppsBuildsClientGetOptions) (resp azfake.Responder[armappcontainers.ContainerAppsBuildsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewContainerAppsBuildsServerTransport creates a new instance of ContainerAppsBuildsServerTransport with the provided implementation. +// The returned ContainerAppsBuildsServerTransport instance is connected to an instance of armappcontainers.ContainerAppsBuildsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContainerAppsBuildsServerTransport(srv *ContainerAppsBuildsServer) *ContainerAppsBuildsServerTransport { + return &ContainerAppsBuildsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.ContainerAppsBuildsClientDeleteResponse]](), + } +} + +// ContainerAppsBuildsServerTransport connects instances of armappcontainers.ContainerAppsBuildsClient to instances of ContainerAppsBuildsServer. +// Don't use this type directly, use NewContainerAppsBuildsServerTransport instead. +type ContainerAppsBuildsServerTransport struct { + srv *ContainerAppsBuildsServer + beginDelete *tracker[azfake.PollerResponder[armappcontainers.ContainerAppsBuildsClientDeleteResponse]] +} + +// Do implements the policy.Transporter interface for ContainerAppsBuildsServerTransport. +func (c *ContainerAppsBuildsServerTransport) 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 "ContainerAppsBuildsClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "ContainerAppsBuildsClient.Get": + resp, err = c.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContainerAppsBuildsServerTransport) 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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?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 + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, containerAppNameParam, buildNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + 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)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ContainerAppsBuildsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?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 + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, containerAppNameParam, buildNameParam, 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).ContainerAppsBuildResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuildsbycontainerapp_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuildsbycontainerapp_server.go new file mode 100644 index 0000000000..31796dd6be --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsbuildsbycontainerapp_server.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// ContainerAppsBuildsByContainerAppServer is a fake server for instances of the armappcontainers.ContainerAppsBuildsByContainerAppClient type. +type ContainerAppsBuildsByContainerAppServer struct { + // NewListPager is the fake for method ContainerAppsBuildsByContainerAppClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, containerAppName string, options *armappcontainers.ContainerAppsBuildsByContainerAppClientListOptions) (resp azfake.PagerResponder[armappcontainers.ContainerAppsBuildsByContainerAppClientListResponse]) +} + +// NewContainerAppsBuildsByContainerAppServerTransport creates a new instance of ContainerAppsBuildsByContainerAppServerTransport with the provided implementation. +// The returned ContainerAppsBuildsByContainerAppServerTransport instance is connected to an instance of armappcontainers.ContainerAppsBuildsByContainerAppClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContainerAppsBuildsByContainerAppServerTransport(srv *ContainerAppsBuildsByContainerAppServer) *ContainerAppsBuildsByContainerAppServerTransport { + return &ContainerAppsBuildsByContainerAppServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armappcontainers.ContainerAppsBuildsByContainerAppClientListResponse]](), + } +} + +// ContainerAppsBuildsByContainerAppServerTransport connects instances of armappcontainers.ContainerAppsBuildsByContainerAppClient to instances of ContainerAppsBuildsByContainerAppServer. +// Don't use this type directly, use NewContainerAppsBuildsByContainerAppServerTransport instead. +type ContainerAppsBuildsByContainerAppServerTransport struct { + srv *ContainerAppsBuildsByContainerAppServer + newListPager *tracker[azfake.PagerResponder[armappcontainers.ContainerAppsBuildsByContainerAppClientListResponse]] +} + +// Do implements the policy.Transporter interface for ContainerAppsBuildsByContainerAppServerTransport. +func (c *ContainerAppsBuildsByContainerAppServerTransport) 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 "ContainerAppsBuildsByContainerAppClient.NewListPager": + resp, err = c.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContainerAppsBuildsByContainerAppServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := c.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds` + 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 + } + containerAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerAppName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListPager(resourceGroupNameParam, containerAppNameParam, nil) + newListPager = &resp + c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.ContainerAppsBuildsByContainerAppClientListResponse, 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) { + c.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + c.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsdiagnostics_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsdiagnostics_server.go index ed86f9954b..1efe63b4ee 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsdiagnostics_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsdiagnostics_server.go @@ -12,14 +12,15 @@ 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/containerappspatches_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappspatches_server.go new file mode 100644 index 0000000000..18be3208ac --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappspatches_server.go @@ -0,0 +1,341 @@ +//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" + "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" +) + +// ContainerAppsPatchesServer is a fake server for instances of the armappcontainers.ContainerAppsPatchesClient type. +type ContainerAppsPatchesServer struct { + // BeginApply is the fake for method ContainerAppsPatchesClient.BeginApply + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginApply func(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *armappcontainers.ContainerAppsPatchesClientBeginApplyOptions) (resp azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientApplyResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ContainerAppsPatchesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *armappcontainers.ContainerAppsPatchesClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ContainerAppsPatchesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, options *armappcontainers.ContainerAppsPatchesClientGetOptions) (resp azfake.Responder[armappcontainers.ContainerAppsPatchesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByContainerAppPager is the fake for method ContainerAppsPatchesClient.NewListByContainerAppPager + // HTTP status codes to indicate success: http.StatusOK + NewListByContainerAppPager func(resourceGroupName string, containerAppName string, options *armappcontainers.ContainerAppsPatchesClientListByContainerAppOptions) (resp azfake.PagerResponder[armappcontainers.ContainerAppsPatchesClientListByContainerAppResponse]) + + // BeginSkipConfigure is the fake for method ContainerAppsPatchesClient.BeginSkipConfigure + // HTTP status codes to indicate success: http.StatusAccepted + BeginSkipConfigure func(ctx context.Context, resourceGroupName string, containerAppName string, patchName string, patchSkipConfig armappcontainers.PatchSkipConfig, options *armappcontainers.ContainerAppsPatchesClientBeginSkipConfigureOptions) (resp azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientSkipConfigureResponse], errResp azfake.ErrorResponder) +} + +// NewContainerAppsPatchesServerTransport creates a new instance of ContainerAppsPatchesServerTransport with the provided implementation. +// The returned ContainerAppsPatchesServerTransport instance is connected to an instance of armappcontainers.ContainerAppsPatchesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContainerAppsPatchesServerTransport(srv *ContainerAppsPatchesServer) *ContainerAppsPatchesServerTransport { + return &ContainerAppsPatchesServerTransport{ + srv: srv, + beginApply: newTracker[azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientApplyResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientDeleteResponse]](), + newListByContainerAppPager: newTracker[azfake.PagerResponder[armappcontainers.ContainerAppsPatchesClientListByContainerAppResponse]](), + beginSkipConfigure: newTracker[azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientSkipConfigureResponse]](), + } +} + +// ContainerAppsPatchesServerTransport connects instances of armappcontainers.ContainerAppsPatchesClient to instances of ContainerAppsPatchesServer. +// Don't use this type directly, use NewContainerAppsPatchesServerTransport instead. +type ContainerAppsPatchesServerTransport struct { + srv *ContainerAppsPatchesServer + beginApply *tracker[azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientApplyResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientDeleteResponse]] + newListByContainerAppPager *tracker[azfake.PagerResponder[armappcontainers.ContainerAppsPatchesClientListByContainerAppResponse]] + beginSkipConfigure *tracker[azfake.PollerResponder[armappcontainers.ContainerAppsPatchesClientSkipConfigureResponse]] +} + +// Do implements the policy.Transporter interface for ContainerAppsPatchesServerTransport. +func (c *ContainerAppsPatchesServerTransport) 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 "ContainerAppsPatchesClient.BeginApply": + resp, err = c.dispatchBeginApply(req) + case "ContainerAppsPatchesClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "ContainerAppsPatchesClient.Get": + resp, err = c.dispatchGet(req) + case "ContainerAppsPatchesClient.NewListByContainerAppPager": + resp, err = c.dispatchNewListByContainerAppPager(req) + case "ContainerAppsPatchesClient.BeginSkipConfigure": + resp, err = c.dispatchBeginSkipConfigure(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContainerAppsPatchesServerTransport) dispatchBeginApply(req *http.Request) (*http.Response, error) { + if c.srv.BeginApply == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginApply not implemented")} + } + beginApply := c.beginApply.get(req) + if beginApply == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/apply` + 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 + } + patchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("patchName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginApply(req.Context(), resourceGroupNameParam, containerAppNameParam, patchNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginApply = &respr + c.beginApply.add(req, beginApply) + } + + resp, err := server.PollerResponderNext(beginApply, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginApply.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginApply) { + c.beginApply.remove(req) + } + + return resp, nil +} + +func (c *ContainerAppsPatchesServerTransport) 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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches/(?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 + } + patchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("patchName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, containerAppNameParam, patchNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + 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)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ContainerAppsPatchesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches/(?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 + } + patchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("patchName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, containerAppNameParam, patchNameParam, 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).ContainerAppsPatchResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ContainerAppsPatchesServerTransport) dispatchNewListByContainerAppPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByContainerAppPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByContainerAppPager not implemented")} + } + newListByContainerAppPager := c.newListByContainerAppPager.get(req) + if newListByContainerAppPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches` + 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.ContainerAppsPatchesClientListByContainerAppOptions + if filterParam != nil { + options = &armappcontainers.ContainerAppsPatchesClientListByContainerAppOptions{ + Filter: filterParam, + } + } + resp := c.srv.NewListByContainerAppPager(resourceGroupNameParam, containerAppNameParam, options) + newListByContainerAppPager = &resp + c.newListByContainerAppPager.add(req, newListByContainerAppPager) + server.PagerResponderInjectNextLinks(newListByContainerAppPager, req, func(page *armappcontainers.ContainerAppsPatchesClientListByContainerAppResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByContainerAppPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByContainerAppPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByContainerAppPager) { + c.newListByContainerAppPager.remove(req) + } + return resp, nil +} + +func (c *ContainerAppsPatchesServerTransport) dispatchBeginSkipConfigure(req *http.Request) (*http.Response, error) { + if c.srv.BeginSkipConfigure == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSkipConfigure not implemented")} + } + beginSkipConfigure := c.beginSkipConfigure.get(req) + if beginSkipConfigure == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skipConfig` + 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.PatchSkipConfig](req) + if err != nil { + return nil, err + } + 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 + } + patchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("patchName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginSkipConfigure(req.Context(), resourceGroupNameParam, containerAppNameParam, patchNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSkipConfigure = &respr + c.beginSkipConfigure.add(req, beginSkipConfigure) + } + + resp, err := server.PollerResponderNext(beginSkipConfigure, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + c.beginSkipConfigure.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSkipConfigure) { + c.beginSkipConfigure.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisionreplicas_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisionreplicas_server.go index e717e5f1fe..f088fef363 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisionreplicas_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisionreplicas_server.go @@ -12,13 +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/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 c067b284ec..25666dad3a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisions_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappsrevisions_server.go @@ -12,14 +12,15 @@ 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 new file mode 100644 index 0000000000..c69f07f68d --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssessionpools_server.go @@ -0,0 +1,354 @@ +//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" + "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" +) + +// ContainerAppsSessionPoolsServer is a fake server for instances of the armappcontainers.ContainerAppsSessionPoolsClient type. +type ContainerAppsSessionPoolsServer struct { + // BeginCreateOrUpdate is the fake for method ContainerAppsSessionPoolsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, sessionPoolName string, sessionPoolEnvelope armappcontainers.SessionPool, options *armappcontainers.ContainerAppsSessionPoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ContainerAppsSessionPoolsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, sessionPoolName string, options *armappcontainers.ContainerAppsSessionPoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ContainerAppsSessionPoolsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, sessionPoolName string, options *armappcontainers.ContainerAppsSessionPoolsClientGetOptions) (resp azfake.Responder[armappcontainers.ContainerAppsSessionPoolsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ContainerAppsSessionPoolsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armappcontainers.ContainerAppsSessionPoolsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armappcontainers.ContainerAppsSessionPoolsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ContainerAppsSessionPoolsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armappcontainers.ContainerAppsSessionPoolsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armappcontainers.ContainerAppsSessionPoolsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method ContainerAppsSessionPoolsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, sessionPoolName string, sessionPoolEnvelope armappcontainers.SessionPoolUpdatableProperties, options *armappcontainers.ContainerAppsSessionPoolsClientBeginUpdateOptions) (resp azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewContainerAppsSessionPoolsServerTransport creates a new instance of ContainerAppsSessionPoolsServerTransport with the provided implementation. +// The returned ContainerAppsSessionPoolsServerTransport instance is connected to an instance of armappcontainers.ContainerAppsSessionPoolsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContainerAppsSessionPoolsServerTransport(srv *ContainerAppsSessionPoolsServer) *ContainerAppsSessionPoolsServerTransport { + return &ContainerAppsSessionPoolsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armappcontainers.ContainerAppsSessionPoolsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armappcontainers.ContainerAppsSessionPoolsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientUpdateResponse]](), + } +} + +// ContainerAppsSessionPoolsServerTransport connects instances of armappcontainers.ContainerAppsSessionPoolsClient to instances of ContainerAppsSessionPoolsServer. +// Don't use this type directly, use NewContainerAppsSessionPoolsServerTransport instead. +type ContainerAppsSessionPoolsServerTransport struct { + srv *ContainerAppsSessionPoolsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armappcontainers.ContainerAppsSessionPoolsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armappcontainers.ContainerAppsSessionPoolsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armappcontainers.ContainerAppsSessionPoolsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ContainerAppsSessionPoolsServerTransport. +func (c *ContainerAppsSessionPoolsServerTransport) 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 "ContainerAppsSessionPoolsClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "ContainerAppsSessionPoolsClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "ContainerAppsSessionPoolsClient.Get": + resp, err = c.dispatchGet(req) + case "ContainerAppsSessionPoolsClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "ContainerAppsSessionPoolsClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "ContainerAppsSessionPoolsClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContainerAppsSessionPoolsServerTransport) 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/sessionPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.SessionPool](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + sessionPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sessionPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, sessionPoolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + 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)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *ContainerAppsSessionPoolsServerTransport) 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/sessionPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + sessionPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sessionPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, sessionPoolNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + 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)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ContainerAppsSessionPoolsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.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/sessionPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + sessionPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sessionPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, sessionPoolNameParam, 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).SessionPool, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ContainerAppsSessionPoolsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/sessionPools` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + 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 + } + resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armappcontainers.ContainerAppsSessionPoolsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *ContainerAppsSessionPoolsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/sessionPools` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armappcontainers.ContainerAppsSessionPoolsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *ContainerAppsSessionPoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + 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/sessionPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.SessionPoolUpdatableProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + sessionPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sessionPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, sessionPoolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + 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)} + } + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssourcecontrols_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssourcecontrols_server.go index 5d7a6ad721..4befa94453 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssourcecontrols_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/containerappssourcecontrols_server.go @@ -12,14 +12,16 @@ 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" ) // ContainerAppsSourceControlsServer is a fake server for instances of the armappcontainers.ContainerAppsSourceControlsClient type. @@ -121,7 +123,14 @@ func (c *ContainerAppsSourceControlsServerTransport) dispatchBeginCreateOrUpdate if err != nil { return nil, err } - respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, containerAppNameParam, sourceControlNameParam, body, nil) + xMSGithubAuxiliaryParam := getOptional(getHeaderValue(req.Header, "x-ms-github-auxiliary")) + var options *armappcontainers.ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions + if xMSGithubAuxiliaryParam != nil { + options = &armappcontainers.ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions{ + XMSGithubAuxiliary: xMSGithubAuxiliaryParam, + } + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, containerAppNameParam, sourceControlNameParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -157,6 +166,7 @@ func (c *ContainerAppsSourceControlsServerTransport) dispatchBeginDelete(req *ht if matches == nil || len(matches) < 4 { 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 @@ -169,7 +179,32 @@ func (c *ContainerAppsSourceControlsServerTransport) dispatchBeginDelete(req *ht if err != nil { return nil, err } - respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, containerAppNameParam, sourceControlNameParam, nil) + xMSGithubAuxiliaryParam := getOptional(getHeaderValue(req.Header, "x-ms-github-auxiliary")) + ignoreWorkflowDeletionFailureUnescaped, err := url.QueryUnescape(qp.Get("ignoreWorkflowDeletionFailure")) + if err != nil { + return nil, err + } + ignoreWorkflowDeletionFailureParam, err := parseOptional(ignoreWorkflowDeletionFailureUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + deleteWorkflowUnescaped, err := url.QueryUnescape(qp.Get("deleteWorkflow")) + if err != nil { + return nil, err + } + deleteWorkflowParam, err := parseOptional(deleteWorkflowUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armappcontainers.ContainerAppsSourceControlsClientBeginDeleteOptions + if xMSGithubAuxiliaryParam != nil || ignoreWorkflowDeletionFailureParam != nil || deleteWorkflowParam != nil { + options = &armappcontainers.ContainerAppsSourceControlsClientBeginDeleteOptions{ + XMSGithubAuxiliary: xMSGithubAuxiliaryParam, + IgnoreWorkflowDeletionFailure: ignoreWorkflowDeletionFailureParam, + DeleteWorkflow: deleteWorkflowParam, + } + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, containerAppNameParam, sourceControlNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponentresiliencypolicies_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponentresiliencypolicies_server.go new file mode 100644 index 0000000000..abadab5a86 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponentresiliencypolicies_server.go @@ -0,0 +1,263 @@ +//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" + "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" +) + +// DaprComponentResiliencyPoliciesServer is a fake server for instances of the armappcontainers.DaprComponentResiliencyPoliciesClient type. +type DaprComponentResiliencyPoliciesServer struct { + // CreateOrUpdate is the fake for method DaprComponentResiliencyPoliciesClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, daprComponentResiliencyPolicyEnvelope armappcontainers.DaprComponentResiliencyPolicy, options *armappcontainers.DaprComponentResiliencyPoliciesClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method DaprComponentResiliencyPoliciesClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, options *armappcontainers.DaprComponentResiliencyPoliciesClientDeleteOptions) (resp azfake.Responder[armappcontainers.DaprComponentResiliencyPoliciesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DaprComponentResiliencyPoliciesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, environmentName string, componentName string, name string, options *armappcontainers.DaprComponentResiliencyPoliciesClientGetOptions) (resp azfake.Responder[armappcontainers.DaprComponentResiliencyPoliciesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method DaprComponentResiliencyPoliciesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, environmentName string, componentName string, options *armappcontainers.DaprComponentResiliencyPoliciesClientListOptions) (resp azfake.PagerResponder[armappcontainers.DaprComponentResiliencyPoliciesClientListResponse]) +} + +// NewDaprComponentResiliencyPoliciesServerTransport creates a new instance of DaprComponentResiliencyPoliciesServerTransport with the provided implementation. +// The returned DaprComponentResiliencyPoliciesServerTransport instance is connected to an instance of armappcontainers.DaprComponentResiliencyPoliciesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDaprComponentResiliencyPoliciesServerTransport(srv *DaprComponentResiliencyPoliciesServer) *DaprComponentResiliencyPoliciesServerTransport { + return &DaprComponentResiliencyPoliciesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armappcontainers.DaprComponentResiliencyPoliciesClientListResponse]](), + } +} + +// DaprComponentResiliencyPoliciesServerTransport connects instances of armappcontainers.DaprComponentResiliencyPoliciesClient to instances of DaprComponentResiliencyPoliciesServer. +// Don't use this type directly, use NewDaprComponentResiliencyPoliciesServerTransport instead. +type DaprComponentResiliencyPoliciesServerTransport struct { + srv *DaprComponentResiliencyPoliciesServer + newListPager *tracker[azfake.PagerResponder[armappcontainers.DaprComponentResiliencyPoliciesClientListResponse]] +} + +// Do implements the policy.Transporter interface for DaprComponentResiliencyPoliciesServerTransport. +func (d *DaprComponentResiliencyPoliciesServerTransport) 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 "DaprComponentResiliencyPoliciesClient.CreateOrUpdate": + resp, err = d.dispatchCreateOrUpdate(req) + case "DaprComponentResiliencyPoliciesClient.Delete": + resp, err = d.dispatchDelete(req) + case "DaprComponentResiliencyPoliciesClient.Get": + resp, err = d.dispatchGet(req) + case "DaprComponentResiliencyPoliciesClient.NewListPager": + resp, err = d.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DaprComponentResiliencyPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.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~%@]+)/daprComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappcontainers.DaprComponentResiliencyPolicy](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 + } + componentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("componentName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, componentNameParam, nameParam, 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).DaprComponentResiliencyPolicy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DaprComponentResiliencyPoliciesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if d.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~%@]+)/daprComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + 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 + } + componentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("componentName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, environmentNameParam, componentNameParam, nameParam, 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 (d *DaprComponentResiliencyPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.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~%@]+)/daprComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + 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 + } + componentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("componentName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, environmentNameParam, componentNameParam, nameParam, 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).DaprComponentResiliencyPolicy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DaprComponentResiliencyPoliciesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := d.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~%@]+)/daprComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies` + 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 + } + componentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("componentName")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListPager(resourceGroupNameParam, environmentNameParam, componentNameParam, nil) + newListPager = &resp + d.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.DaprComponentResiliencyPoliciesClientListResponse, 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) { + d.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + d.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponents_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponents_server.go index 1ac347b26d..7770e429b7 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponents_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprcomponents_server.go @@ -12,14 +12,15 @@ 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 new file mode 100644 index 0000000000..81f4ffa638 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/daprsubscriptions_server.go @@ -0,0 +1,247 @@ +//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" + "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" +) + +// DaprSubscriptionsServer is a fake server for instances of the armappcontainers.DaprSubscriptionsClient type. +type DaprSubscriptionsServer struct { + // CreateOrUpdate is the fake for method DaprSubscriptionsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, environmentName string, name string, daprSubscriptionEnvelope armappcontainers.DaprSubscription, options *armappcontainers.DaprSubscriptionsClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.DaprSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method DaprSubscriptionsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, environmentName string, name string, options *armappcontainers.DaprSubscriptionsClientDeleteOptions) (resp azfake.Responder[armappcontainers.DaprSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DaprSubscriptionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, environmentName string, name string, options *armappcontainers.DaprSubscriptionsClientGetOptions) (resp azfake.Responder[armappcontainers.DaprSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method DaprSubscriptionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, environmentName string, options *armappcontainers.DaprSubscriptionsClientListOptions) (resp azfake.PagerResponder[armappcontainers.DaprSubscriptionsClientListResponse]) +} + +// NewDaprSubscriptionsServerTransport creates a new instance of DaprSubscriptionsServerTransport with the provided implementation. +// The returned DaprSubscriptionsServerTransport instance is connected to an instance of armappcontainers.DaprSubscriptionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDaprSubscriptionsServerTransport(srv *DaprSubscriptionsServer) *DaprSubscriptionsServerTransport { + return &DaprSubscriptionsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armappcontainers.DaprSubscriptionsClientListResponse]](), + } +} + +// DaprSubscriptionsServerTransport connects instances of armappcontainers.DaprSubscriptionsClient to instances of DaprSubscriptionsServer. +// Don't use this type directly, use NewDaprSubscriptionsServerTransport instead. +type DaprSubscriptionsServerTransport struct { + srv *DaprSubscriptionsServer + newListPager *tracker[azfake.PagerResponder[armappcontainers.DaprSubscriptionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for DaprSubscriptionsServerTransport. +func (d *DaprSubscriptionsServerTransport) 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 "DaprSubscriptionsClient.CreateOrUpdate": + resp, err = d.dispatchCreateOrUpdate(req) + case "DaprSubscriptionsClient.Delete": + resp, err = d.dispatchDelete(req) + case "DaprSubscriptionsClient.Get": + resp, err = d.dispatchGet(req) + case "DaprSubscriptionsClient.NewListPager": + resp, err = d.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DaprSubscriptionsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.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~%@]+)/daprSubscriptions/(?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.DaprSubscription](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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, 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).DaprSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DaprSubscriptionsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if d.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~%@]+)/daprSubscriptions/(?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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, 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 (d *DaprSubscriptionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.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~%@]+)/daprSubscriptions/(?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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, 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).DaprSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DaprSubscriptionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := d.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~%@]+)/daprSubscriptions` + 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 := d.srv.NewListPager(resourceGroupNameParam, environmentNameParam, nil) + newListPager = &resp + d.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.DaprSubscriptionsClientListResponse, 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) { + d.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + d.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/dotnetcomponents_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/dotnetcomponents_server.go new file mode 100644 index 0000000000..eb3a6cb617 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/dotnetcomponents_server.go @@ -0,0 +1,333 @@ +//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" + "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" +) + +// DotNetComponentsServer is a fake server for instances of the armappcontainers.DotNetComponentsClient type. +type DotNetComponentsServer struct { + // BeginCreateOrUpdate is the fake for method DotNetComponentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, environmentName string, name string, dotNetComponentEnvelope armappcontainers.DotNetComponent, options *armappcontainers.DotNetComponentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.DotNetComponentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method DotNetComponentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, environmentName string, name string, options *armappcontainers.DotNetComponentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.DotNetComponentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DotNetComponentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, environmentName string, name string, options *armappcontainers.DotNetComponentsClientGetOptions) (resp azfake.Responder[armappcontainers.DotNetComponentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method DotNetComponentsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, environmentName string, options *armappcontainers.DotNetComponentsClientListOptions) (resp azfake.PagerResponder[armappcontainers.DotNetComponentsClientListResponse]) + + // BeginUpdate is the fake for method DotNetComponentsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, environmentName string, name string, dotNetComponentEnvelope armappcontainers.DotNetComponent, options *armappcontainers.DotNetComponentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armappcontainers.DotNetComponentsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewDotNetComponentsServerTransport creates a new instance of DotNetComponentsServerTransport with the provided implementation. +// The returned DotNetComponentsServerTransport instance is connected to an instance of armappcontainers.DotNetComponentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDotNetComponentsServerTransport(srv *DotNetComponentsServer) *DotNetComponentsServerTransport { + return &DotNetComponentsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.DotNetComponentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.DotNetComponentsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armappcontainers.DotNetComponentsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armappcontainers.DotNetComponentsClientUpdateResponse]](), + } +} + +// DotNetComponentsServerTransport connects instances of armappcontainers.DotNetComponentsClient to instances of DotNetComponentsServer. +// Don't use this type directly, use NewDotNetComponentsServerTransport instead. +type DotNetComponentsServerTransport struct { + srv *DotNetComponentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.DotNetComponentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.DotNetComponentsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armappcontainers.DotNetComponentsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armappcontainers.DotNetComponentsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for DotNetComponentsServerTransport. +func (d *DotNetComponentsServerTransport) 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 "DotNetComponentsClient.BeginCreateOrUpdate": + resp, err = d.dispatchBeginCreateOrUpdate(req) + case "DotNetComponentsClient.BeginDelete": + resp, err = d.dispatchBeginDelete(req) + case "DotNetComponentsClient.Get": + resp, err = d.dispatchGet(req) + case "DotNetComponentsClient.NewListPager": + resp, err = d.dispatchNewListPager(req) + case "DotNetComponentsClient.BeginUpdate": + resp, err = d.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DotNetComponentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := d.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dotNetComponents/(?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.DotNetComponent](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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + d.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + d.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + d.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (d *DotNetComponentsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if d.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := d.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dotNetComponents/(?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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + d.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + d.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + d.beginDelete.remove(req) + } + + return resp, nil +} + +func (d *DotNetComponentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.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~%@]+)/dotNetComponents/(?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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, 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).DotNetComponent, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DotNetComponentsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := d.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~%@]+)/dotNetComponents` + 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 := d.srv.NewListPager(resourceGroupNameParam, environmentNameParam, nil) + newListPager = &resp + d.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.DotNetComponentsClientListResponse, 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) { + d.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + d.newListPager.remove(req) + } + return resp, nil +} + +func (d *DotNetComponentsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := d.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dotNetComponents/(?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.DotNetComponent](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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + d.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + d.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + d.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/functionsextension_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/functionsextension_server.go new file mode 100644 index 0000000000..2074b89e16 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/functionsextension_server.go @@ -0,0 +1,109 @@ +//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" + "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" +) + +// FunctionsExtensionServer is a fake server for instances of the armappcontainers.FunctionsExtensionClient type. +type FunctionsExtensionServer struct { + // InvokeFunctionsHost is the fake for method FunctionsExtensionClient.InvokeFunctionsHost + // HTTP status codes to indicate success: http.StatusOK + InvokeFunctionsHost func(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, functionAppName string, options *armappcontainers.FunctionsExtensionClientInvokeFunctionsHostOptions) (resp azfake.Responder[armappcontainers.FunctionsExtensionClientInvokeFunctionsHostResponse], errResp azfake.ErrorResponder) +} + +// NewFunctionsExtensionServerTransport creates a new instance of FunctionsExtensionServerTransport with the provided implementation. +// The returned FunctionsExtensionServerTransport instance is connected to an instance of armappcontainers.FunctionsExtensionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFunctionsExtensionServerTransport(srv *FunctionsExtensionServer) *FunctionsExtensionServerTransport { + return &FunctionsExtensionServerTransport{srv: srv} +} + +// FunctionsExtensionServerTransport connects instances of armappcontainers.FunctionsExtensionClient to instances of FunctionsExtensionServer. +// Don't use this type directly, use NewFunctionsExtensionServerTransport instead. +type FunctionsExtensionServerTransport struct { + srv *FunctionsExtensionServer +} + +// Do implements the policy.Transporter interface for FunctionsExtensionServerTransport. +func (f *FunctionsExtensionServerTransport) 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 "FunctionsExtensionClient.InvokeFunctionsHost": + resp, err = f.dispatchInvokeFunctionsHost(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (f *FunctionsExtensionServerTransport) dispatchInvokeFunctionsHost(req *http.Request) (*http.Response, error) { + if f.srv.InvokeFunctionsHost == nil { + return nil, &nonRetriableError{errors.New("fake for method InvokeFunctionsHost 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~%@]+)/revisions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/functions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/invoke` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + 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 + } + revisionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("revisionName")]) + if err != nil { + return nil, err + } + functionAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("functionAppName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.InvokeFunctionsHost(req.Context(), resourceGroupNameParam, containerAppNameParam, revisionNameParam, functionAppNameParam, 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).Value, 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 94e060e89d..c423f69a92 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/internal.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/internal.go @@ -9,10 +9,11 @@ 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 { @@ -32,6 +33,14 @@ func contains[T comparable](s []T, v T) bool { return false } +func getHeaderValue(h http.Header, k string) string { + v := h[k] + if len(v) == 0 { + return "" + } + return v[0] +} + func getOptional[T any](v T) *T { if reflect.ValueOf(v).IsZero() { return nil @@ -39,6 +48,17 @@ func getOptional[T any](v T) *T { return &v } +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/javacomponents_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/javacomponents_server.go new file mode 100644 index 0000000000..fe84627587 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/javacomponents_server.go @@ -0,0 +1,333 @@ +//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" + "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" +) + +// JavaComponentsServer is a fake server for instances of the armappcontainers.JavaComponentsClient type. +type JavaComponentsServer struct { + // BeginCreateOrUpdate is the fake for method JavaComponentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, environmentName string, name string, javaComponentEnvelope armappcontainers.JavaComponent, options *armappcontainers.JavaComponentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.JavaComponentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method JavaComponentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, environmentName string, name string, options *armappcontainers.JavaComponentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.JavaComponentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method JavaComponentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, environmentName string, name string, options *armappcontainers.JavaComponentsClientGetOptions) (resp azfake.Responder[armappcontainers.JavaComponentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method JavaComponentsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, environmentName string, options *armappcontainers.JavaComponentsClientListOptions) (resp azfake.PagerResponder[armappcontainers.JavaComponentsClientListResponse]) + + // BeginUpdate is the fake for method JavaComponentsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, environmentName string, name string, javaComponentEnvelope armappcontainers.JavaComponent, options *armappcontainers.JavaComponentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armappcontainers.JavaComponentsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewJavaComponentsServerTransport creates a new instance of JavaComponentsServerTransport with the provided implementation. +// The returned JavaComponentsServerTransport instance is connected to an instance of armappcontainers.JavaComponentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewJavaComponentsServerTransport(srv *JavaComponentsServer) *JavaComponentsServerTransport { + return &JavaComponentsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.JavaComponentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.JavaComponentsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armappcontainers.JavaComponentsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armappcontainers.JavaComponentsClientUpdateResponse]](), + } +} + +// JavaComponentsServerTransport connects instances of armappcontainers.JavaComponentsClient to instances of JavaComponentsServer. +// Don't use this type directly, use NewJavaComponentsServerTransport instead. +type JavaComponentsServerTransport struct { + srv *JavaComponentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.JavaComponentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.JavaComponentsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armappcontainers.JavaComponentsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armappcontainers.JavaComponentsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for JavaComponentsServerTransport. +func (j *JavaComponentsServerTransport) 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 "JavaComponentsClient.BeginCreateOrUpdate": + resp, err = j.dispatchBeginCreateOrUpdate(req) + case "JavaComponentsClient.BeginDelete": + resp, err = j.dispatchBeginDelete(req) + case "JavaComponentsClient.Get": + resp, err = j.dispatchGet(req) + case "JavaComponentsClient.NewListPager": + resp, err = j.dispatchNewListPager(req) + case "JavaComponentsClient.BeginUpdate": + resp, err = j.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (j *JavaComponentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if j.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := j.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/javaComponents/(?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.JavaComponent](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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := j.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + j.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + j.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + j.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (j *JavaComponentsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if j.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := j.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/javaComponents/(?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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := j.srv.BeginDelete(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + j.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + j.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + j.beginDelete.remove(req) + } + + return resp, nil +} + +func (j *JavaComponentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if j.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~%@]+)/javaComponents/(?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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := j.srv.Get(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, 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).JavaComponent, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (j *JavaComponentsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if j.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := j.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~%@]+)/javaComponents` + 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 := j.srv.NewListPager(resourceGroupNameParam, environmentNameParam, nil) + newListPager = &resp + j.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armappcontainers.JavaComponentsClientListResponse, 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) { + j.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + j.newListPager.remove(req) + } + return resp, nil +} + +func (j *JavaComponentsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if j.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := j.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/javaComponents/(?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.JavaComponent](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 + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := j.srv.BeginUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, nameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + j.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + j.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + j.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobs_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobs_server.go index 9b6b248660..6813d1e111 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobs_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobs_server.go @@ -12,15 +12,16 @@ 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. @@ -61,6 +62,10 @@ type JobsServer struct { // HTTP status codes to indicate success: http.StatusOK ProxyGet func(ctx context.Context, resourceGroupName string, jobName string, apiName string, options *armappcontainers.JobsClientProxyGetOptions) (resp azfake.Responder[armappcontainers.JobsClientProxyGetResponse], errResp azfake.ErrorResponder) + // BeginResume is the fake for method JobsClient.BeginResume + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginResume func(ctx context.Context, resourceGroupName string, jobName string, options *armappcontainers.JobsClientBeginResumeOptions) (resp azfake.PollerResponder[armappcontainers.JobsClientResumeResponse], errResp azfake.ErrorResponder) + // BeginStart is the fake for method JobsClient.BeginStart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginStart func(ctx context.Context, resourceGroupName string, jobName string, options *armappcontainers.JobsClientBeginStartOptions) (resp azfake.PollerResponder[armappcontainers.JobsClientStartResponse], errResp azfake.ErrorResponder) @@ -73,6 +78,10 @@ type JobsServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginStopMultipleExecutions func(ctx context.Context, resourceGroupName string, jobName string, options *armappcontainers.JobsClientBeginStopMultipleExecutionsOptions) (resp azfake.PollerResponder[armappcontainers.JobsClientStopMultipleExecutionsResponse], errResp azfake.ErrorResponder) + // BeginSuspend is the fake for method JobsClient.BeginSuspend + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSuspend func(ctx context.Context, resourceGroupName string, jobName string, options *armappcontainers.JobsClientBeginSuspendOptions) (resp azfake.PollerResponder[armappcontainers.JobsClientSuspendResponse], errResp azfake.ErrorResponder) + // BeginUpdate is the fake for method JobsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdate func(ctx context.Context, resourceGroupName string, jobName string, jobEnvelope armappcontainers.JobPatchProperties, options *armappcontainers.JobsClientBeginUpdateOptions) (resp azfake.PollerResponder[armappcontainers.JobsClientUpdateResponse], errResp azfake.ErrorResponder) @@ -89,9 +98,11 @@ func NewJobsServerTransport(srv *JobsServer) *JobsServerTransport { newListByResourceGroupPager: newTracker[azfake.PagerResponder[armappcontainers.JobsClientListByResourceGroupResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armappcontainers.JobsClientListBySubscriptionResponse]](), newListDetectorsPager: newTracker[azfake.PagerResponder[armappcontainers.JobsClientListDetectorsResponse]](), + beginResume: newTracker[azfake.PollerResponder[armappcontainers.JobsClientResumeResponse]](), beginStart: newTracker[azfake.PollerResponder[armappcontainers.JobsClientStartResponse]](), beginStopExecution: newTracker[azfake.PollerResponder[armappcontainers.JobsClientStopExecutionResponse]](), beginStopMultipleExecutions: newTracker[azfake.PollerResponder[armappcontainers.JobsClientStopMultipleExecutionsResponse]](), + beginSuspend: newTracker[azfake.PollerResponder[armappcontainers.JobsClientSuspendResponse]](), beginUpdate: newTracker[azfake.PollerResponder[armappcontainers.JobsClientUpdateResponse]](), } } @@ -105,9 +116,11 @@ type JobsServerTransport struct { newListByResourceGroupPager *tracker[azfake.PagerResponder[armappcontainers.JobsClientListByResourceGroupResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armappcontainers.JobsClientListBySubscriptionResponse]] newListDetectorsPager *tracker[azfake.PagerResponder[armappcontainers.JobsClientListDetectorsResponse]] + beginResume *tracker[azfake.PollerResponder[armappcontainers.JobsClientResumeResponse]] beginStart *tracker[azfake.PollerResponder[armappcontainers.JobsClientStartResponse]] beginStopExecution *tracker[azfake.PollerResponder[armappcontainers.JobsClientStopExecutionResponse]] beginStopMultipleExecutions *tracker[azfake.PollerResponder[armappcontainers.JobsClientStopMultipleExecutionsResponse]] + beginSuspend *tracker[azfake.PollerResponder[armappcontainers.JobsClientSuspendResponse]] beginUpdate *tracker[azfake.PollerResponder[armappcontainers.JobsClientUpdateResponse]] } @@ -141,12 +154,16 @@ func (j *JobsServerTransport) Do(req *http.Request) (*http.Response, error) { resp, err = j.dispatchListSecrets(req) case "JobsClient.ProxyGet": resp, err = j.dispatchProxyGet(req) + case "JobsClient.BeginResume": + resp, err = j.dispatchBeginResume(req) case "JobsClient.BeginStart": resp, err = j.dispatchBeginStart(req) case "JobsClient.BeginStopExecution": resp, err = j.dispatchBeginStopExecution(req) case "JobsClient.BeginStopMultipleExecutions": resp, err = j.dispatchBeginStopMultipleExecutions(req) + case "JobsClient.BeginSuspend": + resp, err = j.dispatchBeginSuspend(req) case "JobsClient.BeginUpdate": resp, err = j.dispatchBeginUpdate(req) default: @@ -503,6 +520,50 @@ func (j *JobsServerTransport) dispatchProxyGet(req *http.Request) (*http.Respons return resp, nil } +func (j *JobsServerTransport) dispatchBeginResume(req *http.Request) (*http.Response, error) { + if j.srv.BeginResume == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginResume not implemented")} + } + beginResume := j.beginResume.get(req) + if beginResume == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resume` + 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 + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := j.srv.BeginResume(req.Context(), resourceGroupNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginResume = &respr + j.beginResume.add(req, beginResume) + } + + resp, err := server.PollerResponderNext(beginResume, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + j.beginResume.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginResume) { + j.beginResume.remove(req) + } + + return resp, nil +} + func (j *JobsServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { if j.srv.BeginStart == nil { return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} @@ -649,6 +710,50 @@ func (j *JobsServerTransport) dispatchBeginStopMultipleExecutions(req *http.Requ return resp, nil } +func (j *JobsServerTransport) dispatchBeginSuspend(req *http.Request) (*http.Response, error) { + if j.srv.BeginSuspend == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSuspend not implemented")} + } + beginSuspend := j.beginSuspend.get(req) + if beginSuspend == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/suspend` + 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 + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := j.srv.BeginSuspend(req.Context(), resourceGroupNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSuspend = &respr + j.beginSuspend.add(req, beginSuspend) + } + + resp, err := server.PollerResponderNext(beginSuspend, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + j.beginSuspend.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSuspend) { + j.beginSuspend.remove(req) + } + + return resp, nil +} + func (j *JobsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { if j.srv.BeginUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobsexecutions_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobsexecutions_server.go index e93adae333..819baaab8e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobsexecutions_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/jobsexecutions_server.go @@ -11,14 +11,15 @@ 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 new file mode 100644 index 0000000000..f026494f5a --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/logicapps_server.go @@ -0,0 +1,438 @@ +//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" + "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" +) + +// LogicAppsServer is a fake server for instances of the armappcontainers.LogicAppsClient type. +type LogicAppsServer struct { + // CreateOrUpdate is the fake for method LogicAppsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, resource armappcontainers.LogicApp, options *armappcontainers.LogicAppsClientCreateOrUpdateOptions) (resp azfake.Responder[armappcontainers.LogicAppsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method LogicAppsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *armappcontainers.LogicAppsClientDeleteOptions) (resp azfake.Responder[armappcontainers.LogicAppsClientDeleteResponse], errResp azfake.ErrorResponder) + + // DeployWorkflowArtifacts is the fake for method LogicAppsClient.DeployWorkflowArtifacts + // HTTP status codes to indicate success: http.StatusOK + DeployWorkflowArtifacts func(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *armappcontainers.LogicAppsClientDeployWorkflowArtifactsOptions) (resp azfake.Responder[armappcontainers.LogicAppsClientDeployWorkflowArtifactsResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method LogicAppsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *armappcontainers.LogicAppsClientGetOptions) (resp azfake.Responder[armappcontainers.LogicAppsClientGetResponse], errResp azfake.ErrorResponder) + + // GetWorkflow is the fake for method LogicAppsClient.GetWorkflow + // HTTP status codes to indicate success: http.StatusOK + GetWorkflow func(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, workflowName string, options *armappcontainers.LogicAppsClientGetWorkflowOptions) (resp azfake.Responder[armappcontainers.LogicAppsClientGetWorkflowResponse], errResp azfake.ErrorResponder) + + // Invoke is the fake for method LogicAppsClient.Invoke + // HTTP status codes to indicate success: http.StatusOK + Invoke func(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, xmsLogicAppsProxyPath string, xmsLogicAppsProxyMethod armappcontainers.LogicAppsProxyMethod, options *armappcontainers.LogicAppsClientInvokeOptions) (resp azfake.Responder[armappcontainers.LogicAppsClientInvokeResponse], errResp azfake.ErrorResponder) + + // NewListWorkflowsPager is the fake for method LogicAppsClient.NewListWorkflowsPager + // HTTP status codes to indicate success: http.StatusOK + NewListWorkflowsPager func(resourceGroupName string, containerAppName string, logicAppName string, options *armappcontainers.LogicAppsClientListWorkflowsOptions) (resp azfake.PagerResponder[armappcontainers.LogicAppsClientListWorkflowsResponse]) + + // ListWorkflowsConnections is the fake for method LogicAppsClient.ListWorkflowsConnections + // HTTP status codes to indicate success: http.StatusOK + ListWorkflowsConnections func(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *armappcontainers.LogicAppsClientListWorkflowsConnectionsOptions) (resp azfake.Responder[armappcontainers.LogicAppsClientListWorkflowsConnectionsResponse], errResp azfake.ErrorResponder) +} + +// NewLogicAppsServerTransport creates a new instance of LogicAppsServerTransport with the provided implementation. +// The returned LogicAppsServerTransport instance is connected to an instance of armappcontainers.LogicAppsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewLogicAppsServerTransport(srv *LogicAppsServer) *LogicAppsServerTransport { + return &LogicAppsServerTransport{ + srv: srv, + newListWorkflowsPager: newTracker[azfake.PagerResponder[armappcontainers.LogicAppsClientListWorkflowsResponse]](), + } +} + +// LogicAppsServerTransport connects instances of armappcontainers.LogicAppsClient to instances of LogicAppsServer. +// Don't use this type directly, use NewLogicAppsServerTransport instead. +type LogicAppsServerTransport struct { + srv *LogicAppsServer + newListWorkflowsPager *tracker[azfake.PagerResponder[armappcontainers.LogicAppsClientListWorkflowsResponse]] +} + +// Do implements the policy.Transporter interface for LogicAppsServerTransport. +func (l *LogicAppsServerTransport) 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 "LogicAppsClient.CreateOrUpdate": + resp, err = l.dispatchCreateOrUpdate(req) + case "LogicAppsClient.Delete": + resp, err = l.dispatchDelete(req) + case "LogicAppsClient.DeployWorkflowArtifacts": + resp, err = l.dispatchDeployWorkflowArtifacts(req) + case "LogicAppsClient.Get": + resp, err = l.dispatchGet(req) + case "LogicAppsClient.GetWorkflow": + resp, err = l.dispatchGetWorkflow(req) + case "LogicAppsClient.Invoke": + resp, err = l.dispatchInvoke(req) + case "LogicAppsClient.NewListWorkflowsPager": + resp, err = l.dispatchNewListWorkflowsPager(req) + case "LogicAppsClient.ListWorkflowsConnections": + resp, err = l.dispatchListWorkflowsConnections(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (l *LogicAppsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if l.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?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.LogicApp](req) + if err != nil { + return nil, err + } + 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 + } + logicAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logicAppName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, containerAppNameParam, logicAppNameParam, 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).LogicApp, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (l *LogicAppsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if l.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?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 + } + logicAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logicAppName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Delete(req.Context(), resourceGroupNameParam, containerAppNameParam, logicAppNameParam, 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 (l *LogicAppsServerTransport) dispatchDeployWorkflowArtifacts(req *http.Request) (*http.Response, error) { + if l.srv.DeployWorkflowArtifacts == nil { + return nil, &nonRetriableError{errors.New("fake for method DeployWorkflowArtifacts 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~%@]+)/providers/Microsoft\.App/logicApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deployWorkflowArtifacts` + 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.WorkflowArtifacts](req) + if err != nil { + return nil, err + } + 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 + } + logicAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logicAppName")]) + if err != nil { + return nil, err + } + var options *armappcontainers.LogicAppsClientDeployWorkflowArtifactsOptions + if !reflect.ValueOf(body).IsZero() { + options = &armappcontainers.LogicAppsClientDeployWorkflowArtifactsOptions{ + WorkflowArtifacts: &body, + } + } + respr, errRespr := l.srv.DeployWorkflowArtifacts(req.Context(), resourceGroupNameParam, containerAppNameParam, logicAppNameParam, 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)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (l *LogicAppsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if l.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/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?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 + } + logicAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logicAppName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Get(req.Context(), resourceGroupNameParam, containerAppNameParam, logicAppNameParam, 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).LogicApp, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (l *LogicAppsServerTransport) dispatchGetWorkflow(req *http.Request) (*http.Response, error) { + if l.srv.GetWorkflow == nil { + return nil, &nonRetriableError{errors.New("fake for method GetWorkflow 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~%@]+)/providers/Microsoft\.App/logicApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/workflows/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + 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 + } + logicAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logicAppName")]) + if err != nil { + return nil, err + } + workflowNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workflowName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.GetWorkflow(req.Context(), resourceGroupNameParam, containerAppNameParam, logicAppNameParam, workflowNameParam, 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).WorkflowEnvelope, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (l *LogicAppsServerTransport) dispatchInvoke(req *http.Request) (*http.Response, error) { + if l.srv.Invoke == nil { + return nil, &nonRetriableError{errors.New("fake for method Invoke 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~%@]+)/providers/Microsoft\.App/logicApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/invoke` + 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 + } + logicAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logicAppName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Invoke(req.Context(), resourceGroupNameParam, containerAppNameParam, logicAppNameParam, getHeaderValue(req.Header, "x-ms-logicApps-proxy-path"), armappcontainers.LogicAppsProxyMethod(getHeaderValue(req.Header, "x-ms-logicApps-proxy-method")), 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).Interface, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (l *LogicAppsServerTransport) dispatchNewListWorkflowsPager(req *http.Request) (*http.Response, error) { + if l.srv.NewListWorkflowsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListWorkflowsPager not implemented")} + } + newListWorkflowsPager := l.newListWorkflowsPager.get(req) + if newListWorkflowsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/workflows` + 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 + } + logicAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logicAppName")]) + if err != nil { + return nil, err + } + resp := l.srv.NewListWorkflowsPager(resourceGroupNameParam, containerAppNameParam, logicAppNameParam, nil) + newListWorkflowsPager = &resp + l.newListWorkflowsPager.add(req, newListWorkflowsPager) + server.PagerResponderInjectNextLinks(newListWorkflowsPager, req, func(page *armappcontainers.LogicAppsClientListWorkflowsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListWorkflowsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.newListWorkflowsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListWorkflowsPager) { + l.newListWorkflowsPager.remove(req) + } + return resp, nil +} + +func (l *LogicAppsServerTransport) dispatchListWorkflowsConnections(req *http.Request) (*http.Response, error) { + if l.srv.ListWorkflowsConnections == nil { + return nil, &nonRetriableError{errors.New("fake for method ListWorkflowsConnections 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~%@]+)/providers/Microsoft\.App/logicApps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listWorkflowsConnections` + 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 + } + logicAppNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logicAppName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.ListWorkflowsConnections(req.Context(), resourceGroupNameParam, containerAppNameParam, logicAppNameParam, 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).WorkflowEnvelope, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedcertificates_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedcertificates_server.go index 75a8cf977f..87c79b5e25 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedcertificates_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedcertificates_server.go @@ -12,15 +12,16 @@ 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 5ba01c3597..416184a996 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentdiagnostics_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentdiagnostics_server.go @@ -12,13 +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/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 new file mode 100644 index 0000000000..ba994e2285 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivateendpointconnections_server.go @@ -0,0 +1,273 @@ +//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" + "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" +) + +// ManagedEnvironmentPrivateEndpointConnectionsServer is a fake server for instances of the armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClient type. +type ManagedEnvironmentPrivateEndpointConnectionsServer struct { + // BeginCreateOrUpdate is the fake for method ManagedEnvironmentPrivateEndpointConnectionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, privateEndpointConnectionEnvelope armappcontainers.PrivateEndpointConnection, options *armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ManagedEnvironmentPrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, options *armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ManagedEnvironmentPrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, options *armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ManagedEnvironmentPrivateEndpointConnectionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, environmentName string, options *armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientListOptions) (resp azfake.PagerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientListResponse]) +} + +// NewManagedEnvironmentPrivateEndpointConnectionsServerTransport creates a new instance of ManagedEnvironmentPrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned ManagedEnvironmentPrivateEndpointConnectionsServerTransport instance is connected to an instance of armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewManagedEnvironmentPrivateEndpointConnectionsServerTransport(srv *ManagedEnvironmentPrivateEndpointConnectionsServer) *ManagedEnvironmentPrivateEndpointConnectionsServerTransport { + return &ManagedEnvironmentPrivateEndpointConnectionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientListResponse]](), + } +} + +// ManagedEnvironmentPrivateEndpointConnectionsServerTransport connects instances of armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClient to instances of ManagedEnvironmentPrivateEndpointConnectionsServer. +// Don't use this type directly, use NewManagedEnvironmentPrivateEndpointConnectionsServerTransport instead. +type ManagedEnvironmentPrivateEndpointConnectionsServerTransport struct { + srv *ManagedEnvironmentPrivateEndpointConnectionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armappcontainers.ManagedEnvironmentPrivateEndpointConnectionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for ManagedEnvironmentPrivateEndpointConnectionsServerTransport. +func (m *ManagedEnvironmentPrivateEndpointConnectionsServerTransport) 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 "ManagedEnvironmentPrivateEndpointConnectionsClient.BeginCreateOrUpdate": + resp, err = m.dispatchBeginCreateOrUpdate(req) + case "ManagedEnvironmentPrivateEndpointConnectionsClient.BeginDelete": + resp, err = m.dispatchBeginDelete(req) + case "ManagedEnvironmentPrivateEndpointConnectionsClient.Get": + resp, err = m.dispatchGet(req) + case "ManagedEnvironmentPrivateEndpointConnectionsClient.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 *ManagedEnvironmentPrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := m.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?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.PrivateEndpointConnection](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 + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, environmentNameParam, privateEndpointConnectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + m.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + m.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + m.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (m *ManagedEnvironmentPrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if m.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := m.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?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 + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginDelete(req.Context(), resourceGroupNameParam, environmentNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + m.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + m.beginDelete.remove(req) + } + + return resp, nil +} + +func (m *ManagedEnvironmentPrivateEndpointConnectionsServerTransport) 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~%@]+)/privateEndpointConnections/(?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 + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, environmentNameParam, privateEndpointConnectionNameParam, 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).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedEnvironmentPrivateEndpointConnectionsServerTransport) 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~%@]+)/privateEndpointConnections` + 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.ManagedEnvironmentPrivateEndpointConnectionsClientListResponse, 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/managedenvironmentprivatelinkresources_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivatelinkresources_server.go new file mode 100644 index 0000000000..f215c55c0d --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentprivatelinkresources_server.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// ManagedEnvironmentPrivateLinkResourcesServer is a fake server for instances of the armappcontainers.ManagedEnvironmentPrivateLinkResourcesClient type. +type ManagedEnvironmentPrivateLinkResourcesServer struct { + // NewListPager is the fake for method ManagedEnvironmentPrivateLinkResourcesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, environmentName string, options *armappcontainers.ManagedEnvironmentPrivateLinkResourcesClientListOptions) (resp azfake.PagerResponder[armappcontainers.ManagedEnvironmentPrivateLinkResourcesClientListResponse]) +} + +// NewManagedEnvironmentPrivateLinkResourcesServerTransport creates a new instance of ManagedEnvironmentPrivateLinkResourcesServerTransport with the provided implementation. +// The returned ManagedEnvironmentPrivateLinkResourcesServerTransport instance is connected to an instance of armappcontainers.ManagedEnvironmentPrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewManagedEnvironmentPrivateLinkResourcesServerTransport(srv *ManagedEnvironmentPrivateLinkResourcesServer) *ManagedEnvironmentPrivateLinkResourcesServerTransport { + return &ManagedEnvironmentPrivateLinkResourcesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armappcontainers.ManagedEnvironmentPrivateLinkResourcesClientListResponse]](), + } +} + +// ManagedEnvironmentPrivateLinkResourcesServerTransport connects instances of armappcontainers.ManagedEnvironmentPrivateLinkResourcesClient to instances of ManagedEnvironmentPrivateLinkResourcesServer. +// Don't use this type directly, use NewManagedEnvironmentPrivateLinkResourcesServerTransport instead. +type ManagedEnvironmentPrivateLinkResourcesServerTransport struct { + srv *ManagedEnvironmentPrivateLinkResourcesServer + newListPager *tracker[azfake.PagerResponder[armappcontainers.ManagedEnvironmentPrivateLinkResourcesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ManagedEnvironmentPrivateLinkResourcesServerTransport. +func (m *ManagedEnvironmentPrivateLinkResourcesServerTransport) 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 "ManagedEnvironmentPrivateLinkResourcesClient.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 *ManagedEnvironmentPrivateLinkResourcesServerTransport) 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~%@]+)/privateLinkResources` + 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.ManagedEnvironmentPrivateLinkResourcesClientListResponse, 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/managedenvironments_server.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironments_server.go index 086b1f1c52..9aa9d0e6e9 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironments_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironments_server.go @@ -12,14 +12,15 @@ 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 d7b2a86507..00843cabb2 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsdiagnostics_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsdiagnostics_server.go @@ -12,13 +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/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 2324046f5f..c92629c5f9 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsstorages_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentsstorages_server.go @@ -12,13 +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/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 32087e3a52..68957de128 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentusages_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/managedenvironmentusages_server.go @@ -11,14 +11,15 @@ 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 5dbe1ef42f..01944a7af0 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/namespaces_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/namespaces_server.go @@ -12,13 +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/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 167f397dca..4d523d2865 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/operations_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/operations_server.go @@ -11,12 +11,13 @@ 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 b0f9b60b48..2dff12086e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/server_factory.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/server_factory.go @@ -11,40 +11,58 @@ 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. type ServerFactory struct { - AvailableWorkloadProfilesServer AvailableWorkloadProfilesServer - BillingMetersServer BillingMetersServer - CertificatesServer CertificatesServer - ConnectedEnvironmentsCertificatesServer ConnectedEnvironmentsCertificatesServer - ConnectedEnvironmentsServer ConnectedEnvironmentsServer - ConnectedEnvironmentsDaprComponentsServer ConnectedEnvironmentsDaprComponentsServer - ConnectedEnvironmentsStoragesServer ConnectedEnvironmentsStoragesServer - ContainerAppsAPIServer ContainerAppsAPIServer - ContainerAppsAuthConfigsServer ContainerAppsAuthConfigsServer - ContainerAppsServer ContainerAppsServer - ContainerAppsDiagnosticsServer ContainerAppsDiagnosticsServer - ContainerAppsRevisionReplicasServer ContainerAppsRevisionReplicasServer - ContainerAppsRevisionsServer ContainerAppsRevisionsServer - ContainerAppsSourceControlsServer ContainerAppsSourceControlsServer - DaprComponentsServer DaprComponentsServer - JobsServer JobsServer - JobsExecutionsServer JobsExecutionsServer - ManagedCertificatesServer ManagedCertificatesServer - ManagedEnvironmentDiagnosticsServer ManagedEnvironmentDiagnosticsServer - ManagedEnvironmentUsagesServer ManagedEnvironmentUsagesServer - ManagedEnvironmentsServer ManagedEnvironmentsServer - ManagedEnvironmentsDiagnosticsServer ManagedEnvironmentsDiagnosticsServer - ManagedEnvironmentsStoragesServer ManagedEnvironmentsStoragesServer - NamespacesServer NamespacesServer - OperationsServer OperationsServer - UsagesServer UsagesServer + AppResiliencyServer AppResiliencyServer + AvailableWorkloadProfilesServer AvailableWorkloadProfilesServer + BillingMetersServer BillingMetersServer + BuildAuthTokenServer BuildAuthTokenServer + BuildersServer BuildersServer + BuildsByBuilderResourceServer BuildsByBuilderResourceServer + BuildsServer BuildsServer + CertificatesServer CertificatesServer + ConnectedEnvironmentsCertificatesServer ConnectedEnvironmentsCertificatesServer + ConnectedEnvironmentsServer ConnectedEnvironmentsServer + ConnectedEnvironmentsDaprComponentsServer ConnectedEnvironmentsDaprComponentsServer + ConnectedEnvironmentsStoragesServer ConnectedEnvironmentsStoragesServer + ContainerAppsAPIServer ContainerAppsAPIServer + ContainerAppsAuthConfigsServer ContainerAppsAuthConfigsServer + ContainerAppsBuildsByContainerAppServer ContainerAppsBuildsByContainerAppServer + ContainerAppsBuildsServer ContainerAppsBuildsServer + ContainerAppsServer ContainerAppsServer + ContainerAppsDiagnosticsServer ContainerAppsDiagnosticsServer + ContainerAppsPatchesServer ContainerAppsPatchesServer + ContainerAppsRevisionReplicasServer ContainerAppsRevisionReplicasServer + ContainerAppsRevisionsServer ContainerAppsRevisionsServer + ContainerAppsSessionPoolsServer ContainerAppsSessionPoolsServer + ContainerAppsSourceControlsServer ContainerAppsSourceControlsServer + DaprComponentResiliencyPoliciesServer DaprComponentResiliencyPoliciesServer + DaprComponentsServer DaprComponentsServer + DaprSubscriptionsServer DaprSubscriptionsServer + DotNetComponentsServer DotNetComponentsServer + FunctionsExtensionServer FunctionsExtensionServer + JavaComponentsServer JavaComponentsServer + JobsServer JobsServer + JobsExecutionsServer JobsExecutionsServer + LogicAppsServer LogicAppsServer + ManagedCertificatesServer ManagedCertificatesServer + ManagedEnvironmentDiagnosticsServer ManagedEnvironmentDiagnosticsServer + ManagedEnvironmentPrivateEndpointConnectionsServer ManagedEnvironmentPrivateEndpointConnectionsServer + ManagedEnvironmentPrivateLinkResourcesServer ManagedEnvironmentPrivateLinkResourcesServer + ManagedEnvironmentUsagesServer ManagedEnvironmentUsagesServer + ManagedEnvironmentsServer ManagedEnvironmentsServer + ManagedEnvironmentsDiagnosticsServer ManagedEnvironmentsDiagnosticsServer + ManagedEnvironmentsStoragesServer ManagedEnvironmentsStoragesServer + NamespacesServer NamespacesServer + OperationsServer OperationsServer + UsagesServer UsagesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -59,34 +77,51 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armappcontainers.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAvailableWorkloadProfilesServer *AvailableWorkloadProfilesServerTransport - trBillingMetersServer *BillingMetersServerTransport - trCertificatesServer *CertificatesServerTransport - trConnectedEnvironmentsCertificatesServer *ConnectedEnvironmentsCertificatesServerTransport - trConnectedEnvironmentsServer *ConnectedEnvironmentsServerTransport - trConnectedEnvironmentsDaprComponentsServer *ConnectedEnvironmentsDaprComponentsServerTransport - trConnectedEnvironmentsStoragesServer *ConnectedEnvironmentsStoragesServerTransport - trContainerAppsAPIServer *ContainerAppsAPIServerTransport - trContainerAppsAuthConfigsServer *ContainerAppsAuthConfigsServerTransport - trContainerAppsServer *ContainerAppsServerTransport - trContainerAppsDiagnosticsServer *ContainerAppsDiagnosticsServerTransport - trContainerAppsRevisionReplicasServer *ContainerAppsRevisionReplicasServerTransport - trContainerAppsRevisionsServer *ContainerAppsRevisionsServerTransport - trContainerAppsSourceControlsServer *ContainerAppsSourceControlsServerTransport - trDaprComponentsServer *DaprComponentsServerTransport - trJobsServer *JobsServerTransport - trJobsExecutionsServer *JobsExecutionsServerTransport - trManagedCertificatesServer *ManagedCertificatesServerTransport - trManagedEnvironmentDiagnosticsServer *ManagedEnvironmentDiagnosticsServerTransport - trManagedEnvironmentUsagesServer *ManagedEnvironmentUsagesServerTransport - trManagedEnvironmentsServer *ManagedEnvironmentsServerTransport - trManagedEnvironmentsDiagnosticsServer *ManagedEnvironmentsDiagnosticsServerTransport - trManagedEnvironmentsStoragesServer *ManagedEnvironmentsStoragesServerTransport - trNamespacesServer *NamespacesServerTransport - trOperationsServer *OperationsServerTransport - trUsagesServer *UsagesServerTransport + srv *ServerFactory + trMu sync.Mutex + trAppResiliencyServer *AppResiliencyServerTransport + trAvailableWorkloadProfilesServer *AvailableWorkloadProfilesServerTransport + trBillingMetersServer *BillingMetersServerTransport + trBuildAuthTokenServer *BuildAuthTokenServerTransport + trBuildersServer *BuildersServerTransport + trBuildsByBuilderResourceServer *BuildsByBuilderResourceServerTransport + trBuildsServer *BuildsServerTransport + trCertificatesServer *CertificatesServerTransport + trConnectedEnvironmentsCertificatesServer *ConnectedEnvironmentsCertificatesServerTransport + trConnectedEnvironmentsServer *ConnectedEnvironmentsServerTransport + trConnectedEnvironmentsDaprComponentsServer *ConnectedEnvironmentsDaprComponentsServerTransport + trConnectedEnvironmentsStoragesServer *ConnectedEnvironmentsStoragesServerTransport + trContainerAppsAPIServer *ContainerAppsAPIServerTransport + trContainerAppsAuthConfigsServer *ContainerAppsAuthConfigsServerTransport + trContainerAppsBuildsByContainerAppServer *ContainerAppsBuildsByContainerAppServerTransport + trContainerAppsBuildsServer *ContainerAppsBuildsServerTransport + trContainerAppsServer *ContainerAppsServerTransport + trContainerAppsDiagnosticsServer *ContainerAppsDiagnosticsServerTransport + trContainerAppsPatchesServer *ContainerAppsPatchesServerTransport + trContainerAppsRevisionReplicasServer *ContainerAppsRevisionReplicasServerTransport + trContainerAppsRevisionsServer *ContainerAppsRevisionsServerTransport + trContainerAppsSessionPoolsServer *ContainerAppsSessionPoolsServerTransport + trContainerAppsSourceControlsServer *ContainerAppsSourceControlsServerTransport + trDaprComponentResiliencyPoliciesServer *DaprComponentResiliencyPoliciesServerTransport + trDaprComponentsServer *DaprComponentsServerTransport + trDaprSubscriptionsServer *DaprSubscriptionsServerTransport + trDotNetComponentsServer *DotNetComponentsServerTransport + trFunctionsExtensionServer *FunctionsExtensionServerTransport + trJavaComponentsServer *JavaComponentsServerTransport + trJobsServer *JobsServerTransport + trJobsExecutionsServer *JobsExecutionsServerTransport + trLogicAppsServer *LogicAppsServerTransport + trManagedCertificatesServer *ManagedCertificatesServerTransport + trManagedEnvironmentDiagnosticsServer *ManagedEnvironmentDiagnosticsServerTransport + trManagedEnvironmentPrivateEndpointConnectionsServer *ManagedEnvironmentPrivateEndpointConnectionsServerTransport + trManagedEnvironmentPrivateLinkResourcesServer *ManagedEnvironmentPrivateLinkResourcesServerTransport + trManagedEnvironmentUsagesServer *ManagedEnvironmentUsagesServerTransport + trManagedEnvironmentsServer *ManagedEnvironmentsServerTransport + trManagedEnvironmentsDiagnosticsServer *ManagedEnvironmentsDiagnosticsServerTransport + trManagedEnvironmentsStoragesServer *ManagedEnvironmentsStoragesServerTransport + trNamespacesServer *NamespacesServerTransport + trOperationsServer *OperationsServerTransport + trUsagesServer *UsagesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -102,6 +137,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "AppResiliencyClient": + initServer(s, &s.trAppResiliencyServer, func() *AppResiliencyServerTransport { + return NewAppResiliencyServerTransport(&s.srv.AppResiliencyServer) + }) + resp, err = s.trAppResiliencyServer.Do(req) case "AvailableWorkloadProfilesClient": initServer(s, &s.trAvailableWorkloadProfilesServer, func() *AvailableWorkloadProfilesServerTransport { return NewAvailableWorkloadProfilesServerTransport(&s.srv.AvailableWorkloadProfilesServer) @@ -112,6 +152,22 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewBillingMetersServerTransport(&s.srv.BillingMetersServer) }) resp, err = s.trBillingMetersServer.Do(req) + case "BuildAuthTokenClient": + initServer(s, &s.trBuildAuthTokenServer, func() *BuildAuthTokenServerTransport { + return NewBuildAuthTokenServerTransport(&s.srv.BuildAuthTokenServer) + }) + resp, err = s.trBuildAuthTokenServer.Do(req) + case "BuildersClient": + initServer(s, &s.trBuildersServer, func() *BuildersServerTransport { return NewBuildersServerTransport(&s.srv.BuildersServer) }) + resp, err = s.trBuildersServer.Do(req) + case "BuildsByBuilderResourceClient": + initServer(s, &s.trBuildsByBuilderResourceServer, func() *BuildsByBuilderResourceServerTransport { + return NewBuildsByBuilderResourceServerTransport(&s.srv.BuildsByBuilderResourceServer) + }) + resp, err = s.trBuildsByBuilderResourceServer.Do(req) + case "BuildsClient": + initServer(s, &s.trBuildsServer, func() *BuildsServerTransport { return NewBuildsServerTransport(&s.srv.BuildsServer) }) + resp, err = s.trBuildsServer.Do(req) case "CertificatesClient": initServer(s, &s.trCertificatesServer, func() *CertificatesServerTransport { return NewCertificatesServerTransport(&s.srv.CertificatesServer) }) resp, err = s.trCertificatesServer.Do(req) @@ -145,6 +201,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewContainerAppsAuthConfigsServerTransport(&s.srv.ContainerAppsAuthConfigsServer) }) resp, err = s.trContainerAppsAuthConfigsServer.Do(req) + case "ContainerAppsBuildsByContainerAppClient": + initServer(s, &s.trContainerAppsBuildsByContainerAppServer, func() *ContainerAppsBuildsByContainerAppServerTransport { + return NewContainerAppsBuildsByContainerAppServerTransport(&s.srv.ContainerAppsBuildsByContainerAppServer) + }) + resp, err = s.trContainerAppsBuildsByContainerAppServer.Do(req) + case "ContainerAppsBuildsClient": + initServer(s, &s.trContainerAppsBuildsServer, func() *ContainerAppsBuildsServerTransport { + return NewContainerAppsBuildsServerTransport(&s.srv.ContainerAppsBuildsServer) + }) + resp, err = s.trContainerAppsBuildsServer.Do(req) case "ContainerAppsClient": initServer(s, &s.trContainerAppsServer, func() *ContainerAppsServerTransport { return NewContainerAppsServerTransport(&s.srv.ContainerAppsServer) @@ -155,6 +221,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewContainerAppsDiagnosticsServerTransport(&s.srv.ContainerAppsDiagnosticsServer) }) resp, err = s.trContainerAppsDiagnosticsServer.Do(req) + case "ContainerAppsPatchesClient": + initServer(s, &s.trContainerAppsPatchesServer, func() *ContainerAppsPatchesServerTransport { + return NewContainerAppsPatchesServerTransport(&s.srv.ContainerAppsPatchesServer) + }) + resp, err = s.trContainerAppsPatchesServer.Do(req) case "ContainerAppsRevisionReplicasClient": initServer(s, &s.trContainerAppsRevisionReplicasServer, func() *ContainerAppsRevisionReplicasServerTransport { return NewContainerAppsRevisionReplicasServerTransport(&s.srv.ContainerAppsRevisionReplicasServer) @@ -165,16 +236,46 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewContainerAppsRevisionsServerTransport(&s.srv.ContainerAppsRevisionsServer) }) resp, err = s.trContainerAppsRevisionsServer.Do(req) + case "ContainerAppsSessionPoolsClient": + initServer(s, &s.trContainerAppsSessionPoolsServer, func() *ContainerAppsSessionPoolsServerTransport { + return NewContainerAppsSessionPoolsServerTransport(&s.srv.ContainerAppsSessionPoolsServer) + }) + resp, err = s.trContainerAppsSessionPoolsServer.Do(req) case "ContainerAppsSourceControlsClient": initServer(s, &s.trContainerAppsSourceControlsServer, func() *ContainerAppsSourceControlsServerTransport { return NewContainerAppsSourceControlsServerTransport(&s.srv.ContainerAppsSourceControlsServer) }) resp, err = s.trContainerAppsSourceControlsServer.Do(req) + case "DaprComponentResiliencyPoliciesClient": + initServer(s, &s.trDaprComponentResiliencyPoliciesServer, func() *DaprComponentResiliencyPoliciesServerTransport { + return NewDaprComponentResiliencyPoliciesServerTransport(&s.srv.DaprComponentResiliencyPoliciesServer) + }) + resp, err = s.trDaprComponentResiliencyPoliciesServer.Do(req) case "DaprComponentsClient": initServer(s, &s.trDaprComponentsServer, func() *DaprComponentsServerTransport { return NewDaprComponentsServerTransport(&s.srv.DaprComponentsServer) }) resp, err = s.trDaprComponentsServer.Do(req) + case "DaprSubscriptionsClient": + initServer(s, &s.trDaprSubscriptionsServer, func() *DaprSubscriptionsServerTransport { + return NewDaprSubscriptionsServerTransport(&s.srv.DaprSubscriptionsServer) + }) + resp, err = s.trDaprSubscriptionsServer.Do(req) + case "DotNetComponentsClient": + initServer(s, &s.trDotNetComponentsServer, func() *DotNetComponentsServerTransport { + return NewDotNetComponentsServerTransport(&s.srv.DotNetComponentsServer) + }) + resp, err = s.trDotNetComponentsServer.Do(req) + case "FunctionsExtensionClient": + initServer(s, &s.trFunctionsExtensionServer, func() *FunctionsExtensionServerTransport { + return NewFunctionsExtensionServerTransport(&s.srv.FunctionsExtensionServer) + }) + resp, err = s.trFunctionsExtensionServer.Do(req) + case "JavaComponentsClient": + initServer(s, &s.trJavaComponentsServer, func() *JavaComponentsServerTransport { + return NewJavaComponentsServerTransport(&s.srv.JavaComponentsServer) + }) + resp, err = s.trJavaComponentsServer.Do(req) case "JobsClient": initServer(s, &s.trJobsServer, func() *JobsServerTransport { return NewJobsServerTransport(&s.srv.JobsServer) }) resp, err = s.trJobsServer.Do(req) @@ -183,6 +284,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewJobsExecutionsServerTransport(&s.srv.JobsExecutionsServer) }) resp, err = s.trJobsExecutionsServer.Do(req) + case "LogicAppsClient": + initServer(s, &s.trLogicAppsServer, func() *LogicAppsServerTransport { return NewLogicAppsServerTransport(&s.srv.LogicAppsServer) }) + resp, err = s.trLogicAppsServer.Do(req) case "ManagedCertificatesClient": initServer(s, &s.trManagedCertificatesServer, func() *ManagedCertificatesServerTransport { return NewManagedCertificatesServerTransport(&s.srv.ManagedCertificatesServer) @@ -193,6 +297,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewManagedEnvironmentDiagnosticsServerTransport(&s.srv.ManagedEnvironmentDiagnosticsServer) }) resp, err = s.trManagedEnvironmentDiagnosticsServer.Do(req) + case "ManagedEnvironmentPrivateEndpointConnectionsClient": + initServer(s, &s.trManagedEnvironmentPrivateEndpointConnectionsServer, func() *ManagedEnvironmentPrivateEndpointConnectionsServerTransport { + return NewManagedEnvironmentPrivateEndpointConnectionsServerTransport(&s.srv.ManagedEnvironmentPrivateEndpointConnectionsServer) + }) + resp, err = s.trManagedEnvironmentPrivateEndpointConnectionsServer.Do(req) + case "ManagedEnvironmentPrivateLinkResourcesClient": + initServer(s, &s.trManagedEnvironmentPrivateLinkResourcesServer, func() *ManagedEnvironmentPrivateLinkResourcesServerTransport { + return NewManagedEnvironmentPrivateLinkResourcesServerTransport(&s.srv.ManagedEnvironmentPrivateLinkResourcesServer) + }) + resp, err = s.trManagedEnvironmentPrivateLinkResourcesServer.Do(req) case "ManagedEnvironmentUsagesClient": initServer(s, &s.trManagedEnvironmentUsagesServer, func() *ManagedEnvironmentUsagesServerTransport { return NewManagedEnvironmentUsagesServerTransport(&s.srv.ManagedEnvironmentUsagesServer) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/fake/time_rfc3339.go b/sdk/resourcemanager/appcontainers/armappcontainers/fake/time_rfc3339.go index 81f308b0d3..ade6004b99 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/time_rfc3339.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/time_rfc3339.go @@ -11,11 +11,12 @@ 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 e8fb6fb0f2..f6da5c8fb4 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/fake/usages_server.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/fake/usages_server.go @@ -11,14 +11,15 @@ 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 new file mode 100644 index 0000000000..303593e5ad --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client.go @@ -0,0 +1,120 @@ +//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" + "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" +) + +// FunctionsExtensionClient contains the methods for the FunctionsExtension group. +// Don't use this type directly, use NewFunctionsExtensionClient() instead. +type FunctionsExtensionClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFunctionsExtensionClient creates a new instance of FunctionsExtensionClient 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 NewFunctionsExtensionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FunctionsExtensionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FunctionsExtensionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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. +// - functionAppName - Name of the Function App, the extension resource. +// - options - FunctionsExtensionClientInvokeFunctionsHostOptions contains the optional parameters for the FunctionsExtensionClient.InvokeFunctionsHost +// method. +func (client *FunctionsExtensionClient) InvokeFunctionsHost(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, functionAppName string, options *FunctionsExtensionClientInvokeFunctionsHostOptions) (FunctionsExtensionClientInvokeFunctionsHostResponse, error) { + var err error + const operationName = "FunctionsExtensionClient.InvokeFunctionsHost" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.invokeFunctionsHostCreateRequest(ctx, resourceGroupName, containerAppName, revisionName, functionAppName, options) + if err != nil { + return FunctionsExtensionClientInvokeFunctionsHostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FunctionsExtensionClientInvokeFunctionsHostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FunctionsExtensionClientInvokeFunctionsHostResponse{}, err + } + resp, err := client.invokeFunctionsHostHandleResponse(httpResp) + return resp, err +} + +// invokeFunctionsHostCreateRequest creates the InvokeFunctionsHost request. +func (client *FunctionsExtensionClient) invokeFunctionsHostCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, revisionName string, functionAppName string, options *FunctionsExtensionClientInvokeFunctionsHostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/providers/Microsoft.App/functions/{functionAppName}/invoke" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if containerAppName == "" { + return nil, errors.New("parameter containerAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerAppName}", url.PathEscape(containerAppName)) + if revisionName == "" { + return nil, errors.New("parameter revisionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionName}", url.PathEscape(revisionName)) + if functionAppName == "" { + return nil, errors.New("parameter functionAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{functionAppName}", url.PathEscape(functionAppName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// invokeFunctionsHostHandleResponse handles the InvokeFunctionsHost response. +func (client *FunctionsExtensionClient) invokeFunctionsHostHandleResponse(resp *http.Response) (FunctionsExtensionClientInvokeFunctionsHostResponse, error) { + result := FunctionsExtensionClientInvokeFunctionsHostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { + return FunctionsExtensionClientInvokeFunctionsHostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client_example_test.go new file mode 100644 index 0000000000..7ca0fce770 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/functionsextension_client_example_test.go @@ -0,0 +1,39 @@ +//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/interfaces.go b/sdk/resourcemanager/appcontainers/armappcontainers/interfaces.go new file mode 100644 index 0000000000..192994842a --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/interfaces.go @@ -0,0 +1,19 @@ +//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 + +// JavaComponentPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetJavaComponentProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *JavaComponentProperties, *NacosComponent, *SpringBootAdminComponent, *SpringCloudConfigComponent, *SpringCloudEurekaComponent, +// - *SpringCloudGatewayComponent +type JavaComponentPropertiesClassification interface { + // GetJavaComponentProperties returns the JavaComponentProperties content of the underlying type. + GetJavaComponentProperties() *JavaComponentProperties +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client.go new file mode 100644 index 0000000000..7cfd4fa86f --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client.go @@ -0,0 +1,431 @@ +//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" + "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" +) + +// JavaComponentsClient contains the methods for the JavaComponents group. +// Don't use this type directly, use NewJavaComponentsClient() instead. +type JavaComponentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewJavaComponentsClient creates a new instance of JavaComponentsClient 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 NewJavaComponentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JavaComponentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &JavaComponentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - name - Name of the Java Component. +// - javaComponentEnvelope - Configuration details of the Java Component. +// - options - JavaComponentsClientBeginCreateOrUpdateOptions contains the optional parameters for the JavaComponentsClient.BeginCreateOrUpdate +// method. +func (client *JavaComponentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, name string, javaComponentEnvelope JavaComponent, options *JavaComponentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[JavaComponentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, environmentName, name, javaComponentEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JavaComponentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[JavaComponentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, name, javaComponentEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *JavaComponentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, javaComponentEnvelope JavaComponent, options *JavaComponentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, javaComponentEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Java Component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - JavaComponentsClientBeginDeleteOptions contains the optional parameters for the JavaComponentsClient.BeginDelete +// method. +func (client *JavaComponentsClient) BeginDelete(ctx context.Context, resourceGroupName string, environmentName string, name string, options *JavaComponentsClientBeginDeleteOptions) (*runtime.Poller[JavaComponentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, environmentName, name, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JavaComponentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[JavaComponentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Java Component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + 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, name, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *JavaComponentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, options *JavaComponentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Java Component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - JavaComponentsClientGetOptions contains the optional parameters for the JavaComponentsClient.Get method. +func (client *JavaComponentsClient) Get(ctx context.Context, resourceGroupName string, environmentName string, name string, options *JavaComponentsClientGetOptions) (JavaComponentsClientGetResponse, error) { + var err error + const operationName = "JavaComponentsClient.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, name, options) + if err != nil { + return JavaComponentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return JavaComponentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JavaComponentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *JavaComponentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, options *JavaComponentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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 *JavaComponentsClient) getHandleResponse(resp *http.Response) (JavaComponentsClientGetResponse, error) { + result := JavaComponentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JavaComponent); err != nil { + return JavaComponentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get the Java Components for a managed environment. +// +// Generated from API version 2024-08-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. +func (client *JavaComponentsClient) NewListPager(resourceGroupName string, environmentName string, options *JavaComponentsClientListOptions) *runtime.Pager[JavaComponentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[JavaComponentsClientListResponse]{ + More: func(page JavaComponentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *JavaComponentsClientListResponse) (JavaComponentsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "JavaComponentsClient.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 JavaComponentsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *JavaComponentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *JavaComponentsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents" + 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-08-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 *JavaComponentsClient) listHandleResponse(resp *http.Response) (JavaComponentsClientListResponse, error) { + result := JavaComponentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JavaComponentsCollection); err != nil { + return JavaComponentsClientListResponse{}, err + } + return result, nil +} + +// 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 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - environmentName - Name of the Managed Environment. +// - name - Name of the Java Component. +// - javaComponentEnvelope - Configuration details of the Java Component. +// - options - JavaComponentsClientBeginUpdateOptions contains the optional parameters for the JavaComponentsClient.BeginUpdate +// method. +func (client *JavaComponentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, environmentName string, name string, javaComponentEnvelope JavaComponent, options *JavaComponentsClientBeginUpdateOptions) (*runtime.Poller[JavaComponentsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, environmentName, name, javaComponentEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JavaComponentsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[JavaComponentsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, name, javaComponentEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *JavaComponentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, name string, javaComponentEnvelope JavaComponent, options *JavaComponentsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if environmentName == "" { + return nil, errors.New("parameter environmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{environmentName}", url.PathEscape(environmentName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, javaComponentEnvelope); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client_example_test.go new file mode 100644 index 0000000000..c26fe37fc0 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/javacomponents_client_example_test.go @@ -0,0 +1,593 @@ +//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 b7d0cc1380..2e10df8f5a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type JobsClient struct { } // NewJobsClient creates a new instance of JobsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-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 @@ -73,7 +74,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-03-01 +// Generated from API version 2024-08-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" @@ -115,7 +116,7 @@ func (client *JobsClient) createOrUpdateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, jobEnvelope); err != nil { @@ -127,7 +128,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-03-01 +// Generated from API version 2024-08-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. @@ -152,7 +153,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-03-01 +// Generated from API version 2024-08-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" @@ -194,7 +195,7 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +204,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-03-01 +// Generated from API version 2024-08-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. @@ -249,7 +250,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +268,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-03-01 +// Generated from API version 2024-08-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. @@ -318,7 +319,7 @@ func (client *JobsClient) getDetectorCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -335,7 +336,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-03-01 +// Generated from API version 2024-08-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. @@ -378,7 +379,7 @@ func (client *JobsClient) listByResourceGroupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -395,7 +396,7 @@ func (client *JobsClient) listByResourceGroupHandleResponse(resp *http.Response) // NewListBySubscriptionPager - Get the Container Apps Jobs in a given subscription. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-02-preview // - options - JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.NewListBySubscriptionPager // method. func (client *JobsClient) NewListBySubscriptionPager(options *JobsClientListBySubscriptionOptions) *runtime.Pager[JobsClientListBySubscriptionResponse] { @@ -433,7 +434,7 @@ func (client *JobsClient) listBySubscriptionCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -450,7 +451,7 @@ func (client *JobsClient) listBySubscriptionHandleResponse(resp *http.Response) // NewListDetectorsPager - Get the list of diagnostics for a Container App Job. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -497,7 +498,7 @@ func (client *JobsClient) listDetectorsCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -515,7 +516,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-03-01 +// Generated from API version 2024-08-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. @@ -561,7 +562,7 @@ func (client *JobsClient) listSecretsCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -579,7 +580,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-03-01 +// Generated from API version 2024-08-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. @@ -630,7 +631,7 @@ func (client *JobsClient) proxyGetCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -645,10 +646,86 @@ func (client *JobsClient) proxyGetHandleResponse(resp *http.Response) (JobsClien return result, nil } +// BeginResume - Resumes a suspended job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +func (client *JobsClient) BeginResume(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginResumeOptions) (*runtime.Poller[JobsClientResumeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resume(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JobsClientResumeResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[JobsClientResumeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Resume - Resumes a suspended job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.resumeCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// resumeCreateRequest creates the Resume request. +func (client *JobsClient) resumeCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginResumeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/resume" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginStart - Start a Container Apps Job // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -673,7 +750,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-03-01 +// Generated from API version 2024-08-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" @@ -715,7 +792,7 @@ func (client *JobsClient) startCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Template != nil { @@ -730,7 +807,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-03-01 +// Generated from API version 2024-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - jobName - Job Name // - jobExecutionName - Job execution name. @@ -756,7 +833,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-03-01 +// Generated from API version 2024-08-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" @@ -802,7 +879,7 @@ func (client *JobsClient) stopExecutionCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -811,7 +888,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-03-01 +// Generated from API version 2024-08-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 @@ -837,7 +914,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-03-01 +// Generated from API version 2024-08-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" @@ -879,7 +956,83 @@ func (client *JobsClient) stopMultipleExecutionsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginSuspend - Suspends a job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +func (client *JobsClient) BeginSuspend(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginSuspendOptions) (*runtime.Poller[JobsClientSuspendResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.suspend(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JobsClientSuspendResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[JobsClientSuspendResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Suspend - Suspends a job +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.suspendCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// suspendCreateRequest creates the Suspend request. +func (client *JobsClient) suspendCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *JobsClientBeginSuspendOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/suspend" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -888,7 +1041,7 @@ func (client *JobsClient) stopMultipleExecutionsCreateRequest(ctx context.Contex // 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-03-01 +// Generated from API version 2024-08-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 @@ -913,7 +1066,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-03-01 +// Generated from API version 2024-08-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" @@ -955,7 +1108,7 @@ func (client *JobsClient) updateCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 7f080498f5..9f9d009193 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobs_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ListDetectors.json +// 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 { @@ -68,7 +68,7 @@ func ExampleJobsClient_NewListDetectorsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_GetDetector.json +// 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 { @@ -140,7 +140,7 @@ func ExampleJobsClient_GetDetector() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ProxyGet.json +// 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 { @@ -151,7 +151,7 @@ func ExampleJobsClient_ProxyGet() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewJobsClient().ProxyGet(ctx, "rg", "testcontainerappsjob0", "rootApi", nil) + res, err := clientFactory.NewJobsClient().ProxyGet(ctx, "rg", "testcontainerAppsJob0", "rootApi", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -159,9 +159,9 @@ func ExampleJobsClient_ProxyGet() { _ = 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"), + // 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"), + // 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{ @@ -178,20 +178,20 @@ func ExampleJobsClient_ProxyGet() { // Template: &armappcontainers.JobTemplate{ // Containers: []*armappcontainers.Container{ // { - // Name: to.Ptr("testcontainerappsjob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerAppsJob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // }, @@ -199,7 +199,7 @@ func ExampleJobsClient_ProxyGet() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Jobs_ListBySubscription.json +// 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 { @@ -224,9 +224,9 @@ func ExampleJobsClient_NewListBySubscriptionPager() { // page.JobsCollection = armappcontainers.JobsCollection{ // Value: []*armappcontainers.Job{ // { - // Name: to.Ptr("testcontainerappsjob0"), + // 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"), + // 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{ @@ -243,29 +243,29 @@ func ExampleJobsClient_NewListBySubscriptionPager() { // Template: &armappcontainers.JobTemplate{ // Containers: []*armappcontainers.Container{ // { - // Name: to.Ptr("testcontainerappsjob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerAppsJob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // }, // }, // }, // { - // Name: to.Ptr("testcontainerappsjob1"), + // 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"), + // 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{ @@ -283,20 +283,20 @@ func ExampleJobsClient_NewListBySubscriptionPager() { // Template: &armappcontainers.JobTemplate{ // Containers: []*armappcontainers.Container{ // { - // Name: to.Ptr("testcontainerappsjob1"), - // Image: to.Ptr("repo/testcontainerappsjob1:v4"), + // Name: to.Ptr("testcontainerAppsJob1"), + // Image: to.Ptr("repo/testcontainerAppsJob1:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerAppsJob1"), - // Image: to.Ptr("repo/testcontainerappsjob1:v4"), + // Image: to.Ptr("repo/testcontainerAppsJob1:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // }, @@ -306,7 +306,7 @@ func ExampleJobsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Jobs_ListByResourceGroup.json +// 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 { @@ -331,9 +331,9 @@ func ExampleJobsClient_NewListByResourceGroupPager() { // page.JobsCollection = armappcontainers.JobsCollection{ // Value: []*armappcontainers.Job{ // { - // Name: to.Ptr("testcontainerappsjob0"), + // 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"), + // 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{ @@ -350,29 +350,29 @@ func ExampleJobsClient_NewListByResourceGroupPager() { // Template: &armappcontainers.JobTemplate{ // Containers: []*armappcontainers.Container{ // { - // Name: to.Ptr("testcontainerappsjob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerAppsJob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // }, // }, // }, // { - // Name: to.Ptr("testcontainerappsjob1"), + // 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"), + // 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{ @@ -391,10 +391,10 @@ func ExampleJobsClient_NewListByResourceGroupPager() { // Containers: []*armappcontainers.Container{ // { // Name: to.Ptr("testcontainerApp0"), - // Image: to.Ptr("repo/testcontainerappsjob1:v4"), + // Image: to.Ptr("repo/testcontainerAppsJob1:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ @@ -402,8 +402,8 @@ func ExampleJobsClient_NewListByResourceGroupPager() { // Name: to.Ptr("testinitcontainerApp0"), // Image: to.Ptr("repo/testinitcontainerAppsJob1:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // }, @@ -413,7 +413,7 @@ func ExampleJobsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Get.json +// 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 { @@ -424,7 +424,7 @@ func ExampleJobsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewJobsClient().Get(ctx, "rg", "testcontainerappsjob0", nil) + res, err := clientFactory.NewJobsClient().Get(ctx, "rg", "testcontainerAppsJob0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -432,12 +432,32 @@ func ExampleJobsClient_Get() { _ = 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"), + // 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"), + // 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), @@ -451,28 +471,50 @@ func ExampleJobsClient_Get() { // Template: &armappcontainers.JobTemplate{ // Containers: []*armappcontainers.Container{ // { - // Name: to.Ptr("testcontainerappsjob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_CreateorUpdate.json +// 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 { @@ -483,10 +525,25 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJob() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewJobsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerappsjob0", armappcontainers.Job{ + 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), @@ -499,8 +556,19 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJob() { Template: &armappcontainers.JobTemplate{ Containers: []*armappcontainers.Container{ { - Name: to.Ptr("testcontainerappsjob0"), - Image: to.Ptr("repo/testcontainerappsjob0:v1"), + 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), @@ -525,10 +593,10 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJob() { to.Ptr("while true; do echo hello; sleep 10;done")}, Command: []*string{ to.Ptr("/bin/sh")}, - Image: to.Ptr("repo/testcontainerappsjob0:v4"), + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](0.5), - Memory: to.Ptr("1Gi"), + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), }, }}, }, @@ -545,12 +613,32 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJob() { _ = 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"), + // 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"), + // 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), @@ -565,11 +653,175 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJob() { // Template: &armappcontainers.JobTemplate{ // Containers: []*armappcontainers.Container{ // { - // Name: to.Ptr("testcontainerappsjob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // 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{ // { @@ -595,10 +847,10 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJob() { // to.Ptr("while true; do echo hello; sleep 10;done")}, // Command: []*string{ // to.Ptr("/bin/sh")}, - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // }, @@ -606,7 +858,7 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJob() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_CreateorUpdate_EventTrigger.json +// 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 { @@ -617,8 +869,14 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewJobsClient().BeginCreateOrUpdate(ctx, "rg", "testcontainerappsjob0", armappcontainers.Job{ + 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{ @@ -630,8 +888,9 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve PollingInterval: to.Ptr[int32](40), Rules: []*armappcontainers.JobScaleRule{ { - Name: to.Ptr("servicebuscalingrule"), - Type: to.Ptr("azure-servicebus"), + 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", }, @@ -646,8 +905,8 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve Template: &armappcontainers.JobTemplate{ Containers: []*armappcontainers.Container{ { - Name: to.Ptr("testcontainerappsjob0"), - Image: to.Ptr("repo/testcontainerappsjob0:v1"), + Name: to.Ptr("testcontainerAppsJob0"), + Image: to.Ptr("repo/testcontainerAppsJob0:v1"), }}, InitContainers: []*armappcontainers.InitContainer{ { @@ -657,10 +916,10 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve to.Ptr("while true; do echo hello; sleep 10;done")}, Command: []*string{ to.Ptr("/bin/sh")}, - Image: to.Ptr("repo/testcontainerappsjob0:v4"), + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](0.5), - Memory: to.Ptr("1Gi"), + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), }, }}, }, @@ -677,10 +936,19 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve _ = 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"), + // 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"), + // 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{ @@ -692,10 +960,11 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve // PollingInterval: to.Ptr[int32](20), // Rules: []*armappcontainers.JobScaleRule{ // { - // Name: to.Ptr("githubscalingrule"), - // Type: to.Ptr("github-runner"), + // 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{ - // "githubAPIURL": "https://api.github.com", + // "topicName": "my-topic", // }, // }}, // }, @@ -710,11 +979,11 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve // Template: &armappcontainers.JobTemplate{ // Containers: []*armappcontainers.Container{ // { - // Name: to.Ptr("testcontainerappsjob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ @@ -725,10 +994,10 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve // to.Ptr("while true; do echo hello; sleep 10;done")}, // Command: []*string{ // to.Ptr("/bin/sh")}, - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // }, @@ -736,7 +1005,7 @@ func ExampleJobsClient_BeginCreateOrUpdate_createOrUpdateContainerAppsJobWithEve // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Delete.json +// 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 { @@ -747,7 +1016,7 @@ func ExampleJobsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewJobsClient().BeginDelete(ctx, "rg", "testworkercontainerappsjob0", nil) + poller, err := clientFactory.NewJobsClient().BeginDelete(ctx, "rg", "testWorkerContainerAppsJob0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -757,7 +1026,7 @@ func ExampleJobsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Patch.json +// 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 { @@ -768,7 +1037,7 @@ func ExampleJobsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewJobsClient().BeginUpdate(ctx, "rg", "testcontainerappsjob0", armappcontainers.JobPatchProperties{ + poller, err := clientFactory.NewJobsClient().BeginUpdate(ctx, "rg", "testcontainerAppsJob0", armappcontainers.JobPatchProperties{ Properties: &armappcontainers.JobPatchPropertiesProperties{ Configuration: &armappcontainers.JobConfiguration{ ManualTriggerConfig: &armappcontainers.JobConfigurationManualTriggerConfig{ @@ -782,8 +1051,8 @@ func ExampleJobsClient_BeginUpdate() { Template: &armappcontainers.JobTemplate{ Containers: []*armappcontainers.Container{ { - Name: to.Ptr("testcontainerappsjob0"), - Image: to.Ptr("repo/testcontainerappsjob0:v1"), + Name: to.Ptr("testcontainerAppsJob0"), + Image: to.Ptr("repo/testcontainerAppsJob0:v1"), Probes: []*armappcontainers.ContainerAppProbe{ { Type: to.Ptr(armappcontainers.TypeLiveness), @@ -808,10 +1077,10 @@ func ExampleJobsClient_BeginUpdate() { to.Ptr("while true; do echo hello; sleep 10;done")}, Command: []*string{ to.Ptr("/bin/sh")}, - Image: to.Ptr("repo/testcontainerappsjob0:v4"), + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](0.5), - Memory: to.Ptr("1Gi"), + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), }, }}, }, @@ -828,9 +1097,9 @@ func ExampleJobsClient_BeginUpdate() { _ = 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"), + // 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"), + // 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{ @@ -847,20 +1116,20 @@ func ExampleJobsClient_BeginUpdate() { // Template: &armappcontainers.JobTemplate{ // Containers: []*armappcontainers.Container{ // { - // Name: to.Ptr("testcontainerappsjob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Name: to.Ptr("testcontainerAppsJob0"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // InitContainers: []*armappcontainers.InitContainer{ // { // Name: to.Ptr("testinitcontainerAppsJob0"), - // Image: to.Ptr("repo/testcontainerappsjob0:v4"), + // Image: to.Ptr("repo/testcontainerAppsJob0:v4"), // Resources: &armappcontainers.ContainerResources{ - // CPU: to.Ptr[float64](0.5), - // Memory: to.Ptr("1Gi"), + // CPU: to.Ptr[float64](0.2), + // Memory: to.Ptr("100Mi"), // }, // }}, // }, @@ -868,7 +1137,7 @@ func ExampleJobsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Start.json +// 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 { @@ -879,14 +1148,14 @@ func ExampleJobsClient_BeginStart() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewJobsClient().BeginStart(ctx, "rg", "testcontainerappsjob0", &armappcontainers.JobsClientBeginStartOptions{Template: &armappcontainers.JobExecutionTemplate{ + 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"), + Name: to.Ptr("testcontainerAppsJob0"), + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](0.5), - Memory: to.Ptr("1Gi"), + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), }, }}, InitContainers: []*armappcontainers.JobExecutionContainer{ @@ -897,10 +1166,10 @@ func ExampleJobsClient_BeginStart() { to.Ptr("while true; do echo hello; sleep 10;done")}, Command: []*string{ to.Ptr("/bin/sh")}, - Image: to.Ptr("repo/testcontainerappsjob0:v4"), + Image: to.Ptr("repo/testcontainerAppsJob0:v4"), Resources: &armappcontainers.ContainerResources{ - CPU: to.Ptr[float64](0.5), - Memory: to.Ptr("1Gi"), + CPU: to.Ptr[float64](0.2), + Memory: to.Ptr("100Mi"), }, }}, }, @@ -916,12 +1185,12 @@ func ExampleJobsClient_BeginStart() { _ = 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"), + // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Stop_Execution.json +// 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 { @@ -932,7 +1201,7 @@ func ExampleJobsClient_BeginStopExecution() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewJobsClient().BeginStopExecution(ctx, "rg", "testcontainerappsjob0", "jobExecution1", nil) + poller, err := clientFactory.NewJobsClient().BeginStopExecution(ctx, "rg", "testcontainerAppsJob0", "jobExecution1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -942,7 +1211,7 @@ func ExampleJobsClient_BeginStopExecution() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Stop_Multiple.json +// 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 { @@ -953,7 +1222,7 @@ func ExampleJobsClient_BeginStopMultipleExecutions() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewJobsClient().BeginStopMultipleExecutions(ctx, "rg", "testcontainerappsjob0", nil) + poller, err := clientFactory.NewJobsClient().BeginStopMultipleExecutions(ctx, "rg", "testcontainerAppsJob0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -993,7 +1262,7 @@ func ExampleJobsClient_BeginStopMultipleExecutions() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ListSecrets.json +// 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 { @@ -1004,7 +1273,7 @@ func ExampleJobsClient_ListSecrets() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewJobsClient().ListSecrets(ctx, "rg", "testcontainerappsjob0", nil) + res, err := clientFactory.NewJobsClient().ListSecrets(ctx, "rg", "testcontainerAppsJob0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1021,3 +1290,193 @@ func ExampleJobsClient_ListSecrets() { // }}, // } } + +// 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 78ea9257a6..aeedbecf99 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type JobsExecutionsClient struct { } // NewJobsExecutionsClient creates a new instance of JobsExecutionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewJobsExecutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsExecutionsClient, error) { @@ -45,7 +46,7 @@ func NewJobsExecutionsClient(subscriptionID string, credential azcore.TokenCrede // NewListPager - Get a Container Apps Job's executions // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -95,7 +96,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-03-01") + reqQP.Set("api-version", "2024-08-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 index c67e337dd8..a0766b3171 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/jobsexecutions_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Executions_Get.json +// 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 { @@ -28,7 +28,7 @@ func ExampleJobsExecutionsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewJobsExecutionsClient().NewListPager("rg", "testcontainerappsjob0", &armappcontainers.JobsExecutionsClientListOptions{Filter: nil}) + pager := clientFactory.NewJobsExecutionsClient().NewListPager("rg", "testcontainerAppsJob0", &armappcontainers.JobsExecutionsClientListOptions{Filter: nil}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -44,6 +44,25 @@ func ExampleJobsExecutionsClient_NewListPager() { // { // 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), diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client.go new file mode 100644 index 0000000000..20e0e8d952 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client.go @@ -0,0 +1,600 @@ +//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" + "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" +) + +// LogicAppsClient contains the methods for the LogicApps group. +// Don't use this type directly, use NewLogicAppsClient() instead. +type LogicAppsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLogicAppsClient creates a new instance of LogicAppsClient 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 NewLogicAppsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogicAppsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LogicAppsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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. +// - resource - Logic app resource properties. +// - options - LogicAppsClientCreateOrUpdateOptions contains the optional parameters for the LogicAppsClient.CreateOrUpdate +// method. +func (client *LogicAppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, resource LogicApp, options *LogicAppsClientCreateOrUpdateOptions) (LogicAppsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "LogicAppsClient.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, containerAppName, logicAppName, resource, options) + if err != nil { + return LogicAppsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicAppsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return LogicAppsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LogicAppsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, resource LogicApp, options *LogicAppsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}" + 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 logicAppName == "" { + return nil, errors.New("parameter logicAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicAppName}", url.PathEscape(logicAppName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *LogicAppsClient) createOrUpdateHandleResponse(resp *http.Response) (LogicAppsClientCreateOrUpdateResponse, error) { + result := LogicAppsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LogicApp); err != nil { + return LogicAppsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// 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 +// - 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. +// - options - LogicAppsClientDeleteOptions contains the optional parameters for the LogicAppsClient.Delete method. +func (client *LogicAppsClient) Delete(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientDeleteOptions) (LogicAppsClientDeleteResponse, error) { + var err error + const operationName = "LogicAppsClient.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, containerAppName, logicAppName, options) + if err != nil { + return LogicAppsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicAppsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return LogicAppsClientDeleteResponse{}, err + } + return LogicAppsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LogicAppsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}" + 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 logicAppName == "" { + return nil, errors.New("parameter logicAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicAppName}", url.PathEscape(logicAppName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 +// - 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. +// - options - LogicAppsClientDeployWorkflowArtifactsOptions contains the optional parameters for the LogicAppsClient.DeployWorkflowArtifacts +// method. +func (client *LogicAppsClient) DeployWorkflowArtifacts(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientDeployWorkflowArtifactsOptions) (LogicAppsClientDeployWorkflowArtifactsResponse, error) { + var err error + const operationName = "LogicAppsClient.DeployWorkflowArtifacts" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deployWorkflowArtifactsCreateRequest(ctx, resourceGroupName, containerAppName, logicAppName, options) + if err != nil { + return LogicAppsClientDeployWorkflowArtifactsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicAppsClientDeployWorkflowArtifactsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LogicAppsClientDeployWorkflowArtifactsResponse{}, err + } + return LogicAppsClientDeployWorkflowArtifactsResponse{}, nil +} + +// deployWorkflowArtifactsCreateRequest creates the DeployWorkflowArtifacts request. +func (client *LogicAppsClient) deployWorkflowArtifactsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientDeployWorkflowArtifactsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/deployWorkflowArtifacts" + 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 logicAppName == "" { + return nil, errors.New("parameter logicAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicAppName}", url.PathEscape(logicAppName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.WorkflowArtifacts != nil { + if err := runtime.MarshalAsJSON(req, *options.WorkflowArtifacts); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// 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 +// - 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. +// - options - LogicAppsClientGetOptions contains the optional parameters for the LogicAppsClient.Get method. +func (client *LogicAppsClient) Get(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientGetOptions) (LogicAppsClientGetResponse, error) { + var err error + const operationName = "LogicAppsClient.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, containerAppName, logicAppName, options) + if err != nil { + return LogicAppsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicAppsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LogicAppsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LogicAppsClient) getCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}" + 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 logicAppName == "" { + return nil, errors.New("parameter logicAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicAppName}", url.PathEscape(logicAppName)) + 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-08-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 *LogicAppsClient) getHandleResponse(resp *http.Response) (LogicAppsClientGetResponse, error) { + result := LogicAppsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LogicApp); err != nil { + return LogicAppsClientGetResponse{}, err + } + return result, nil +} + +// 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 +// - 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. +// - workflowName - Workflow name. +// - options - LogicAppsClientGetWorkflowOptions contains the optional parameters for the LogicAppsClient.GetWorkflow method. +func (client *LogicAppsClient) GetWorkflow(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, workflowName string, options *LogicAppsClientGetWorkflowOptions) (LogicAppsClientGetWorkflowResponse, error) { + var err error + const operationName = "LogicAppsClient.GetWorkflow" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getWorkflowCreateRequest(ctx, resourceGroupName, containerAppName, logicAppName, workflowName, options) + if err != nil { + return LogicAppsClientGetWorkflowResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicAppsClientGetWorkflowResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LogicAppsClientGetWorkflowResponse{}, err + } + resp, err := client.getWorkflowHandleResponse(httpResp) + return resp, err +} + +// getWorkflowCreateRequest creates the GetWorkflow request. +func (client *LogicAppsClient) getWorkflowCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, workflowName string, options *LogicAppsClientGetWorkflowOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows/{workflowName}" + 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 logicAppName == "" { + return nil, errors.New("parameter logicAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicAppName}", url.PathEscape(logicAppName)) + if workflowName == "" { + return nil, errors.New("parameter workflowName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workflowName}", url.PathEscape(workflowName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getWorkflowHandleResponse handles the GetWorkflow response. +func (client *LogicAppsClient) getWorkflowHandleResponse(resp *http.Response) (LogicAppsClientGetWorkflowResponse, error) { + result := LogicAppsClientGetWorkflowResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowEnvelope); err != nil { + return LogicAppsClientGetWorkflowResponse{}, err + } + return result, nil +} + +// 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 +// - 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. +// - xmsLogicAppsProxyPath - The proxy path for the API call +// - xmsLogicAppsProxyMethod - The proxy method for the API call +// - options - LogicAppsClientInvokeOptions contains the optional parameters for the LogicAppsClient.Invoke method. +func (client *LogicAppsClient) Invoke(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, xmsLogicAppsProxyPath string, xmsLogicAppsProxyMethod LogicAppsProxyMethod, options *LogicAppsClientInvokeOptions) (LogicAppsClientInvokeResponse, error) { + var err error + const operationName = "LogicAppsClient.Invoke" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.invokeCreateRequest(ctx, resourceGroupName, containerAppName, logicAppName, xmsLogicAppsProxyPath, xmsLogicAppsProxyMethod, options) + if err != nil { + return LogicAppsClientInvokeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicAppsClientInvokeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LogicAppsClientInvokeResponse{}, err + } + resp, err := client.invokeHandleResponse(httpResp) + return resp, err +} + +// invokeCreateRequest creates the Invoke request. +func (client *LogicAppsClient) invokeCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, xmsLogicAppsProxyPath string, xmsLogicAppsProxyMethod LogicAppsProxyMethod, options *LogicAppsClientInvokeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/invoke" + 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 logicAppName == "" { + return nil, errors.New("parameter logicAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicAppName}", url.PathEscape(logicAppName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-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)} + req.Raw().Header["x-ms-logicApps-proxy-path"] = []string{xmsLogicAppsProxyPath} + return req, nil +} + +// invokeHandleResponse handles the Invoke response. +func (client *LogicAppsClient) invokeHandleResponse(resp *http.Response) (LogicAppsClientInvokeResponse, error) { + result := LogicAppsClientInvokeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { + return LogicAppsClientInvokeResponse{}, err + } + return result, nil +} + +// NewListWorkflowsPager - List the workflows for a logic app. +// +// Generated from API version 2024-08-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. +// - options - LogicAppsClientListWorkflowsOptions contains the optional parameters for the LogicAppsClient.NewListWorkflowsPager +// method. +func (client *LogicAppsClient) NewListWorkflowsPager(resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientListWorkflowsOptions) *runtime.Pager[LogicAppsClientListWorkflowsResponse] { + return runtime.NewPager(runtime.PagingHandler[LogicAppsClientListWorkflowsResponse]{ + More: func(page LogicAppsClientListWorkflowsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LogicAppsClientListWorkflowsResponse) (LogicAppsClientListWorkflowsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LogicAppsClient.NewListWorkflowsPager") + 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.listWorkflowsCreateRequest(ctx, resourceGroupName, containerAppName, logicAppName, options) + }, nil) + if err != nil { + return LogicAppsClientListWorkflowsResponse{}, err + } + return client.listWorkflowsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listWorkflowsCreateRequest creates the ListWorkflows request. +func (client *LogicAppsClient) listWorkflowsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientListWorkflowsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows" + 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 logicAppName == "" { + return nil, errors.New("parameter logicAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicAppName}", url.PathEscape(logicAppName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listWorkflowsHandleResponse handles the ListWorkflows response. +func (client *LogicAppsClient) listWorkflowsHandleResponse(resp *http.Response) (LogicAppsClientListWorkflowsResponse, error) { + result := LogicAppsClientListWorkflowsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowEnvelopeCollection); err != nil { + return LogicAppsClientListWorkflowsResponse{}, err + } + return result, nil +} + +// ListWorkflowsConnections - Gets logic app's connections. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-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. +// - options - LogicAppsClientListWorkflowsConnectionsOptions contains the optional parameters for the LogicAppsClient.ListWorkflowsConnections +// method. +func (client *LogicAppsClient) ListWorkflowsConnections(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientListWorkflowsConnectionsOptions) (LogicAppsClientListWorkflowsConnectionsResponse, error) { + var err error + const operationName = "LogicAppsClient.ListWorkflowsConnections" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listWorkflowsConnectionsCreateRequest(ctx, resourceGroupName, containerAppName, logicAppName, options) + if err != nil { + return LogicAppsClientListWorkflowsConnectionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogicAppsClientListWorkflowsConnectionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LogicAppsClientListWorkflowsConnectionsResponse{}, err + } + resp, err := client.listWorkflowsConnectionsHandleResponse(httpResp) + return resp, err +} + +// listWorkflowsConnectionsCreateRequest creates the ListWorkflowsConnections request. +func (client *LogicAppsClient) listWorkflowsConnectionsCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, logicAppName string, options *LogicAppsClientListWorkflowsConnectionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/listWorkflowsConnections" + 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 logicAppName == "" { + return nil, errors.New("parameter logicAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{logicAppName}", url.PathEscape(logicAppName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listWorkflowsConnectionsHandleResponse handles the ListWorkflowsConnections response. +func (client *LogicAppsClient) listWorkflowsConnectionsHandleResponse(resp *http.Response) (LogicAppsClientListWorkflowsConnectionsResponse, error) { + result := LogicAppsClientListWorkflowsConnectionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowEnvelope); err != nil { + return LogicAppsClientListWorkflowsConnectionsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client_example_test.go new file mode 100644 index 0000000000..c655b9398d --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/logicapps_client_example_test.go @@ -0,0 +1,384 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armappcontainers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/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/managedcertificates_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go index 561089f597..61abb6a682 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ManagedCertificatesClient struct { } // NewManagedCertificatesClient creates a new instance of ManagedCertificatesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewManagedCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedCertificatesClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-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. @@ -73,7 +74,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-03-01 +// Generated from API version 2024-08-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" @@ -119,7 +120,7 @@ func (client *ManagedCertificatesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.ManagedCertificateEnvelope != nil { @@ -134,7 +135,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-03-01 +// Generated from API version 2024-08-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. @@ -185,7 +186,7 @@ func (client *ManagedCertificatesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -194,7 +195,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-03-01 +// Generated from API version 2024-08-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. @@ -245,7 +246,7 @@ func (client *ManagedCertificatesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +263,7 @@ func (client *ManagedCertificatesClient) getHandleResponse(resp *http.Response) // NewListPager - Get the Managed Certificates in a given managed environment. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -310,7 +311,7 @@ func (client *ManagedCertificatesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +329,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-03-01 +// Generated from API version 2024-08-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. @@ -381,7 +382,7 @@ func (client *ManagedCertificatesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index fd95ef7149..fee377ba1c 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedcertificates_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_Get.json +// 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 { @@ -48,7 +48,7 @@ func ExampleManagedCertificatesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_CreateOrUpdate.json +// 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 { @@ -89,7 +89,7 @@ func ExampleManagedCertificatesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_Delete.json +// 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 { @@ -106,7 +106,7 @@ func ExampleManagedCertificatesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificates_Patch.json +// 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 { @@ -141,7 +141,7 @@ func ExampleManagedCertificatesClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificates_ListByManagedEnvironment.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go index ed7ef98548..8bf0c7813b 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ManagedEnvironmentDiagnosticsClient struct { } // NewManagedEnvironmentDiagnosticsClient creates a new instance of ManagedEnvironmentDiagnosticsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewManagedEnvironmentDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentDiagnosticsClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-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. @@ -98,7 +99,7 @@ func (client *ManagedEnvironmentDiagnosticsClient) getDetectorCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,7 +117,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-03-01 +// Generated from API version 2024-08-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 @@ -163,7 +164,7 @@ func (client *ManagedEnvironmentDiagnosticsClient) listDetectorsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index ff95e895c8..6d4d02796d 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentdiagnostics_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentDiagnostics_List.json +// 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 { @@ -62,7 +62,7 @@ func ExampleManagedEnvironmentDiagnosticsClient_ListDetectors() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentDiagnostics_Get.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client.go new file mode 100644 index 0000000000..6bc7c941c3 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client.go @@ -0,0 +1,346 @@ +//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" + "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" +) + +// ManagedEnvironmentPrivateEndpointConnectionsClient contains the methods for the ManagedEnvironmentPrivateEndpointConnections group. +// Don't use this type directly, use NewManagedEnvironmentPrivateEndpointConnectionsClient() instead. +type ManagedEnvironmentPrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedEnvironmentPrivateEndpointConnectionsClient creates a new instance of ManagedEnvironmentPrivateEndpointConnectionsClient 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 NewManagedEnvironmentPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentPrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedEnvironmentPrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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. +// - privateEndpointConnectionEnvelope - The resource of private endpoint and its properties +// - options - ManagedEnvironmentPrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters +// for the ManagedEnvironmentPrivateEndpointConnectionsClient.BeginCreateOrUpdate method. +func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, privateEndpointConnectionEnvelope PrivateEndpointConnection, options *ManagedEnvironmentPrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, environmentName, privateEndpointConnectionName, privateEndpointConnectionEnvelope, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, privateEndpointConnectionName, privateEndpointConnectionEnvelope, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, privateEndpointConnectionEnvelope PrivateEndpointConnection, options *ManagedEnvironmentPrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, privateEndpointConnectionEnvelope); err != nil { + return nil, err + } + return req, nil +} + +// 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 +// - 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. +// - options - ManagedEnvironmentPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the +// ManagedEnvironmentPrivateEndpointConnectionsClient.BeginDelete method. +func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, options *ManagedEnvironmentPrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, environmentName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 +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" + 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, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, options *ManagedEnvironmentPrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 +// - 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. +// - options - ManagedEnvironmentPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the ManagedEnvironmentPrivateEndpointConnectionsClient.Get +// method. +func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, options *ManagedEnvironmentPrivateEndpointConnectionsClientGetOptions) (ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "ManagedEnvironmentPrivateEndpointConnectionsClient.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, privateEndpointConnectionName, options) + if err != nil { + return ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, privateEndpointConnectionName string, options *ManagedEnvironmentPrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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-08-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 *ManagedEnvironmentPrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse, error) { + result := ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List private endpoint connections for a given managed environment. +// +// Generated from API version 2024-08-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 +// method. +func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, environmentName string, options *ManagedEnvironmentPrivateEndpointConnectionsClientListOptions) *runtime.Pager[ManagedEnvironmentPrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedEnvironmentPrivateEndpointConnectionsClientListResponse]{ + More: func(page ManagedEnvironmentPrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedEnvironmentPrivateEndpointConnectionsClientListResponse) (ManagedEnvironmentPrivateEndpointConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedEnvironmentPrivateEndpointConnectionsClient.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 ManagedEnvironmentPrivateEndpointConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedEnvironmentPrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentPrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections" + 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-08-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 *ManagedEnvironmentPrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (ManagedEnvironmentPrivateEndpointConnectionsClientListResponse, error) { + result := ManagedEnvironmentPrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return ManagedEnvironmentPrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client_example_test.go new file mode 100644 index 0000000000..8a79a75723 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivateendpointconnections_client_example_test.go @@ -0,0 +1,187 @@ +//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 new file mode 100644 index 0000000000..0fd6546349 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// ManagedEnvironmentPrivateLinkResourcesClient contains the methods for the ManagedEnvironmentPrivateLinkResources group. +// Don't use this type directly, use NewManagedEnvironmentPrivateLinkResourcesClient() instead. +type ManagedEnvironmentPrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedEnvironmentPrivateLinkResourcesClient creates a new instance of ManagedEnvironmentPrivateLinkResourcesClient 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 NewManagedEnvironmentPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentPrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedEnvironmentPrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List private link resources for a given managed environment. +// +// Generated from API version 2024-08-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 +// method. +func (client *ManagedEnvironmentPrivateLinkResourcesClient) NewListPager(resourceGroupName string, environmentName string, options *ManagedEnvironmentPrivateLinkResourcesClientListOptions) *runtime.Pager[ManagedEnvironmentPrivateLinkResourcesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedEnvironmentPrivateLinkResourcesClientListResponse]{ + More: func(page ManagedEnvironmentPrivateLinkResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedEnvironmentPrivateLinkResourcesClientListResponse) (ManagedEnvironmentPrivateLinkResourcesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedEnvironmentPrivateLinkResourcesClient.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 ManagedEnvironmentPrivateLinkResourcesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedEnvironmentPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *ManagedEnvironmentPrivateLinkResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateLinkResources" + 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-08-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 *ManagedEnvironmentPrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (ManagedEnvironmentPrivateLinkResourcesClientListResponse, error) { + result := ManagedEnvironmentPrivateLinkResourcesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return ManagedEnvironmentPrivateLinkResourcesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client_example_test.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client_example_test.go new file mode 100644 index 0000000000..31b687d7c2 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentprivatelinkresources_client_example_test.go @@ -0,0 +1,58 @@ +//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 8937d34b35..8594f861c6 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ManagedEnvironmentsClient struct { } // NewManagedEnvironmentsClient creates a new instance of ManagedEnvironmentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewManagedEnvironmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentsClient, error) { @@ -46,7 +47,7 @@ func NewManagedEnvironmentsClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Creates or updates a Managed Environment used to host container apps. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -72,7 +73,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-03-01 +// Generated from API version 2024-08-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" @@ -114,7 +115,7 @@ func (client *ManagedEnvironmentsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, environmentEnvelope); err != nil { @@ -126,7 +127,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-03-01 +// Generated from API version 2024-08-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 @@ -151,7 +152,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-03-01 +// Generated from API version 2024-08-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" @@ -193,7 +194,7 @@ func (client *ManagedEnvironmentsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +203,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-03-01 +// Generated from API version 2024-08-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. @@ -248,7 +249,7 @@ func (client *ManagedEnvironmentsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +267,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-03-01 +// Generated from API version 2024-08-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 @@ -313,7 +314,7 @@ func (client *ManagedEnvironmentsClient) getAuthTokenCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +331,7 @@ func (client *ManagedEnvironmentsClient) getAuthTokenHandleResponse(resp *http.R // NewListByResourceGroupPager - Get all the Managed Environments in a resource group. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -373,7 +374,7 @@ func (client *ManagedEnvironmentsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -390,7 +391,7 @@ func (client *ManagedEnvironmentsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Get all Managed Environments for a subscription. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-02-preview // - options - ManagedEnvironmentsClientListBySubscriptionOptions contains the optional parameters for the ManagedEnvironmentsClient.NewListBySubscriptionPager // method. func (client *ManagedEnvironmentsClient) NewListBySubscriptionPager(options *ManagedEnvironmentsClientListBySubscriptionOptions) *runtime.Pager[ManagedEnvironmentsClientListBySubscriptionResponse] { @@ -428,7 +429,7 @@ func (client *ManagedEnvironmentsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -445,7 +446,7 @@ func (client *ManagedEnvironmentsClient) listBySubscriptionHandleResponse(resp * // NewListWorkloadProfileStatesPager - Get all workload Profile States for a Managed Environment. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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 @@ -493,7 +494,7 @@ func (client *ManagedEnvironmentsClient) listWorkloadProfileStatesCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -511,7 +512,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-03-01 +// Generated from API version 2024-08-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. @@ -537,7 +538,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-03-01 +// Generated from API version 2024-08-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" @@ -579,7 +580,7 @@ func (client *ManagedEnvironmentsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 7299ca233f..16a949dae5 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironments_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListBySubscription.json +// 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 { @@ -68,6 +68,7 @@ func ExampleManagedEnvironmentsClient_NewListBySubscriptionPager() { // 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"), @@ -99,6 +100,13 @@ func ExampleManagedEnvironmentsClient_NewListBySubscriptionPager() { // 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"), @@ -121,7 +129,7 @@ func ExampleManagedEnvironmentsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListByResourceGroup.json +// 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 { @@ -171,6 +179,7 @@ func ExampleManagedEnvironmentsClient_NewListByResourceGroupPager() { // 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"), @@ -224,7 +233,7 @@ func ExampleManagedEnvironmentsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Get.json +// 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 { @@ -284,6 +293,7 @@ func ExampleManagedEnvironmentsClient_Get() { // 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"), @@ -309,7 +319,7 @@ func ExampleManagedEnvironmentsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +// 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 { @@ -342,6 +352,7 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironmentWithC 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"), @@ -404,6 +415,7 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironmentWithC // 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"), @@ -429,7 +441,7 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironmentWithC // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_CreateOrUpdate.json +// 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 { @@ -442,11 +454,21 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironments() { } 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"), - SharedKey: to.Ptr("string"), + CustomerID: to.Ptr("string"), + DynamicJSONColumns: to.Ptr(true), + SharedKey: to.Ptr("string"), }, }, CustomDomainConfiguration: &armappcontainers.CustomDomainConfiguration{ @@ -455,6 +477,39 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironments() { 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), @@ -471,6 +526,7 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironments() { 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"), @@ -509,10 +565,22 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironments() { // 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{ @@ -525,45 +593,71 @@ func ExampleManagedEnvironmentsClient_BeginCreateOrUpdate_createEnvironments() { // DefaultDomain: to.Ptr("testcontainerenv.k4apps.io"), // EventStreamEndpoint: to.Ptr("testEndpoint"), // InfrastructureResourceGroup: to.Ptr("capp-svc-testcontainerenv-eastus"), - // PeerAuthentication: &armappcontainers.ManagedEnvironmentPropertiesPeerAuthentication{ - // Mtls: &armappcontainers.Mtls{ - // Enabled: to.Ptr(true), + // 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), + // }}, // }, - // }, - // ProvisioningState: to.Ptr(armappcontainers.EnvironmentProvisioningStateSucceeded), - // StaticIP: to.Ptr("1.2.3.4"), - // VnetConfiguration: &armappcontainers.VnetConfiguration{ - // InfrastructureSubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1"), - // }, - // WorkloadProfiles: []*armappcontainers.WorkloadProfile{ - // { - // Name: to.Ptr("My-GP-01"), - // MaximumCount: to.Ptr[int32](12), - // MinimumCount: to.Ptr[int32](3), - // WorkloadProfileType: to.Ptr("GeneralPurpose"), - // }, - // { - // Name: to.Ptr("My-MO-01"), - // MaximumCount: to.Ptr[int32](6), - // MinimumCount: to.Ptr[int32](3), - // WorkloadProfileType: to.Ptr("MemoryOptimized"), - // }, - // { - // Name: to.Ptr("My-CO-01"), - // MaximumCount: to.Ptr[int32](6), - // MinimumCount: to.Ptr[int32](3), - // WorkloadProfileType: to.Ptr("ComputeOptimized"), - // }, - // { - // Name: to.Ptr("My-consumption-01"), - // WorkloadProfileType: to.Ptr("Consumption"), - // }}, - // ZoneRedundant: to.Ptr(true), - // }, - // } + // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Delete.json +// 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 { @@ -584,7 +678,7 @@ func ExampleManagedEnvironmentsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Patch.json +// 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 { @@ -635,6 +729,7 @@ func ExampleManagedEnvironmentsClient_BeginUpdate() { // 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"), @@ -660,7 +755,7 @@ func ExampleManagedEnvironmentsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_GetAuthToken.json +// 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 { @@ -690,7 +785,7 @@ func ExampleManagedEnvironmentsClient_GetAuthToken() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListWorkloadProfileStates.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go index 3dcb890bdb..e93563d0e5 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ManagedEnvironmentsDiagnosticsClient struct { } // NewManagedEnvironmentsDiagnosticsClient creates a new instance of ManagedEnvironmentsDiagnosticsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewManagedEnvironmentsDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentsDiagnosticsClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-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 @@ -93,7 +94,7 @@ func (client *ManagedEnvironmentsDiagnosticsClient) getRootCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index e2c1d4aba1..0b5a0dcd3a 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsdiagnostics_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Get.json +// 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 { @@ -77,6 +77,7 @@ func ExampleManagedEnvironmentsDiagnosticsClient_GetRoot() { // 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"), diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go index 63385c9d99..0115419b12 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ManagedEnvironmentsStoragesClient struct { } // NewManagedEnvironmentsStoragesClient creates a new instance of ManagedEnvironmentsStoragesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewManagedEnvironmentsStoragesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentsStoragesClient, error) { @@ -46,7 +47,7 @@ func NewManagedEnvironmentsStoragesClient(subscriptionID string, credential azco // CreateOrUpdate - Create or update storage for a managedEnvironment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -99,7 +100,7 @@ func (client *ManagedEnvironmentsStoragesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, storageEnvelope); err != nil { @@ -120,7 +121,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-03-01 +// Generated from API version 2024-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -171,7 +172,7 @@ func (client *ManagedEnvironmentsStoragesClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +181,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-03-01 +// Generated from API version 2024-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - environmentName - Name of the Environment. // - storageName - Name of the storage. @@ -232,7 +233,7 @@ func (client *ManagedEnvironmentsStoragesClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +251,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-03-01 +// Generated from API version 2024-08-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 @@ -297,7 +298,7 @@ func (client *ManagedEnvironmentsStoragesClient) listCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index e38bc3c4fa..063691e729 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentsstorages_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_List.json +// 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 { @@ -49,12 +49,24 @@ func ExampleManagedEnvironmentsStoragesClient_List() { // 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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_Get.json -func ExampleManagedEnvironmentsStoragesClient_Get() { +// 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) @@ -85,8 +97,40 @@ func ExampleManagedEnvironmentsStoragesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json -func ExampleManagedEnvironmentsStoragesClient_CreateOrUpdate() { +// 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) @@ -126,7 +170,47 @@ func ExampleManagedEnvironmentsStoragesClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_Delete.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client.go index 9e3a627c40..9f7b5b3a1f 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type ManagedEnvironmentUsagesClient struct { } // NewManagedEnvironmentUsagesClient creates a new instance of ManagedEnvironmentUsagesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewManagedEnvironmentUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedEnvironmentUsagesClient, error) { @@ -45,7 +46,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-03-01 +// Generated from API version 2024-08-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 @@ -93,7 +94,7 @@ func (client *ManagedEnvironmentUsagesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 98d92ef2c1..731f8e4d52 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/managedenvironmentusages_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentUsages_List.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/models.go b/sdk/resourcemanager/appcontainers/armappcontainers/models.go index 238fb13958..fd954fb505 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/models.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/models.go @@ -25,6 +25,12 @@ type AllowedPrincipals struct { Identities []*string } +// AppInsightsConfiguration - Configuration of Application Insights +type AppInsightsConfiguration struct { + // Application Insights connection string + ConnectionString *string +} + // AppLogsConfiguration - Configuration of application logs type AppLogsConfiguration struct { // Logs destination, can be 'log-analytics', 'azure-monitor' or 'none' @@ -43,6 +49,54 @@ type AppRegistration struct { AppSecretSettingName *string } +// AppResiliency - Configuration to setup App Resiliency +type AppResiliency struct { + // App Resiliency resource specific properties + Properties *AppResiliencyProperties + + // 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 +} + +// AppResiliencyCollection - Collection of AppResiliency policies +type AppResiliencyCollection struct { + // REQUIRED; Collection of resources. + Value []*AppResiliency + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// AppResiliencyProperties - App Resiliency resource specific properties +type AppResiliencyProperties struct { + // Policy that defines circuit breaker conditions + CircuitBreakerPolicy *CircuitBreakerPolicy + + // Defines parameters for http connection pooling + HTTPConnectionPool *HTTPConnectionPool + + // Policy that defines http request retry conditions + HTTPRetryPolicy *HTTPRetryPolicy + + // Defines parameters for tcp connection pooling + TCPConnectionPool *TCPConnectionPool + + // Policy that defines tcp request retry conditions + TCPRetryPolicy *TCPRetryPolicy + + // Policy to set request timeouts + TimeoutPolicy *TimeoutPolicy +} + // Apple - The configuration settings of the Apple provider. type Apple struct { // false if the Apple provider should not be enabled despite the set registration; otherwise, true. @@ -69,7 +123,7 @@ type AuthConfig struct { // AuthConfig resource specific properties Properties *AuthConfigProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -141,7 +195,7 @@ type AvailableWorkloadProfile struct { // Revision resource specific properties Properties *AvailableWorkloadProfileProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -320,6 +374,10 @@ type BaseContainer struct { // Container image tag. Image *string + // The type of the image. Set to CloudBuild to let the system manages the image, where user will not be able to update image + // through image field. Set to ContainerImage for user provided image. + ImageType *ImageType + // Custom container name. Name *string @@ -375,6 +433,150 @@ type BlobStorageTokenStore struct { SasURLSettingName *string } +// BuildCollection - The response of a BuildResource list operation. +type BuildCollection struct { + // REQUIRED; The BuildResource items on this page + Value []*BuildResource + + // The link to the next page of items + NextLink *string +} + +// BuildConfiguration - Configuration of the build. +type BuildConfiguration struct { + // Base OS used to build and run the app. + BaseOs *string + + // List of environment variables to be passed to the build, secrets should not be used in environment variable. + EnvironmentVariables []*EnvironmentVariable + + // Platform to be used to build and run the app. + Platform *string + + // Platform version to be used to build and run the app. + PlatformVersion *string + + // List of steps to perform before the build. + PreBuildSteps []*PreBuildStep +} + +// BuildProperties - The build properties. +type BuildProperties struct { + // Configuration of the build. + Configuration *BuildConfiguration + + // Container registry that the final image will be uploaded to. + DestinationContainerRegistry *ContainerRegistryWithCustomImage + + // READ-ONLY; Status of the build once it has been provisioned. + BuildStatus *BuildStatus + + // READ-ONLY; Endpoint from which the build logs can be streamed. + LogStreamEndpoint *string + + // READ-ONLY; Build provisioning state. + ProvisioningState *BuildProvisioningState + + // READ-ONLY; Endpoint to use to retrieve an authentication token for log streaming and uploading source code. + TokenEndpoint *string + + // READ-ONLY; Endpoint to which the source code should be uploaded. + UploadEndpoint *string +} + +// BuildResource - Information pertaining to an individual build. +type BuildResource struct { + // The resource-specific properties for this resource. + Properties *BuildProperties + + // 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 +} + +// BuildToken - Build Auth Token. +type BuildToken struct { + // READ-ONLY; Token expiration date. + Expires *time.Time + + // READ-ONLY; Authentication token. + Token *string +} + +// BuilderCollection - The response of a BuilderResource list operation. +type BuilderCollection struct { + // REQUIRED; The BuilderResource items on this page + Value []*BuilderResource + + // The link to the next page of items + NextLink *string +} + +// BuilderProperties - The builder properties. +type BuilderProperties struct { + // REQUIRED; Resource ID of the container apps environment that the builder is associated with. + EnvironmentID *string + + // List of mappings of container registries and the managed identity used to connect to it. + ContainerRegistries []*ContainerRegistry + + // READ-ONLY; Provisioning state of a builder resource. + ProvisioningState *BuilderProvisioningState +} + +// BuilderResource - Information about the SourceToCloud builder resource. +type BuilderResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The resource-specific properties for this resource. + Properties *BuilderProperties + + // Resource tags. + Tags map[string]*string + + // 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 +} + +// BuilderResourceUpdate - The type used for update operations of the BuilderResource. +type BuilderResourceUpdate struct { + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The updatable properties of the BuilderResource. + Properties *BuilderResourceUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// BuilderResourceUpdateProperties - The updatable properties of the BuilderResource. +type BuilderResourceUpdateProperties struct { + // Resource ID of the container apps environment that the builder is associated with. + EnvironmentID *string +} + // Certificate used for Custom Domain bindings of Container Apps in a Managed Environment type Certificate struct { // REQUIRED; The geo-location where the resource lives @@ -386,7 +588,7 @@ type Certificate struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -408,6 +610,15 @@ type CertificateCollection struct { NextLink *string } +// CertificateKeyVaultProperties - Properties for a certificate stored in a Key Vault. +type CertificateKeyVaultProperties struct { + // Resource ID of a managed identity to authenticate with Azure Key Vault, or System to use a system-assigned identity. + Identity *string + + // URL pointing to the Azure Key Vault secret that holds the certificate. + KeyVaultURL *string +} + // CertificatePatch - A certificate to update type CertificatePatch struct { // Application-specific metadata in the form of key-value pairs. @@ -416,6 +627,12 @@ type CertificatePatch struct { // CertificateProperties - Certificate resource specific properties type CertificateProperties struct { + // Properties for a certificate stored in a Key Vault. + CertificateKeyVaultProperties *CertificateKeyVaultProperties + + // The type of the certificate. Allowed values are ServerSSLCertificate and ImagePullTrustedCA + CertificateType *CertificateType + // Certificate password. Password *string @@ -471,6 +688,19 @@ type CheckNameAvailabilityResponse struct { Reason *CheckNameAvailabilityReason } +// CircuitBreakerPolicy - Policy that defines circuit breaker conditions +type CircuitBreakerPolicy struct { + // Number of consecutive errors before the circuit breaker opens + ConsecutiveErrors *int32 + + // The time interval, in seconds, between endpoint checks. This can result in opening the circuit breaker if the check fails + // as well as closing the circuit breaker if the check succeeds. Defaults to 10s. + IntervalInSeconds *int32 + + // Maximum percentage of hosts that will be ejected after failure threshold has been met + MaxEjectionPercent *int32 +} + // ClientRegistration - The configuration settings of the app registration for providers that have client ids and client secrets type ClientRegistration struct { // The Client ID of the app used for login. @@ -490,6 +720,10 @@ type Configuration struct { // Dapr configuration for the Container App. Dapr *Dapr + // Optional settings for Managed Identities that are assigned to the Container App. If a Managed Identity is not specified + // here, default settings will be used. + IdentitySettings []*IdentitySettings + // Ingress configurations. Ingress *Ingress @@ -499,6 +733,9 @@ type Configuration struct { // Collection of private container registry credentials for containers used by the Container app Registries []*RegistryCredentials + // App runtime configuration for the Container App. + Runtime *Runtime + // Collection of secrets used by a Container app Secrets []*Secret @@ -520,7 +757,7 @@ type ConnectedEnvironment struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -568,7 +805,7 @@ type ConnectedEnvironmentStorage struct { // Storage properties Properties *ConnectedEnvironmentStorageProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -585,6 +822,9 @@ type ConnectedEnvironmentStorage struct { type ConnectedEnvironmentStorageProperties struct { // Azure file properties AzureFile *AzureFileProperties + + // SMB storage properties + Smb *SmbStorage } // ConnectedEnvironmentStoragesCollection - Collection of Storage for Environments @@ -607,6 +847,10 @@ type Container struct { // Container image tag. Image *string + // The type of the image. Set to CloudBuild to let the system manages the image, where user will not be able to update image + // through image field. Set to ContainerImage for user provided image. + ImageType *ImageType + // Custom container name. Name *string @@ -632,6 +876,11 @@ type ContainerApp struct { // in code. Identity *ManagedServiceIdentity + // Metadata used to render different experiences for resources of the same type; e.g. WorkflowApp is a kind of Microsoft.App/ContainerApps + // type. If supported, the resource provider must validate and + // persist this value. + Kind *Kind + // The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another // Azure resource. If this is present, complete mode deployment will not // delete the resource if it is removed from the template since it is managed by another resource. @@ -643,7 +892,7 @@ type ContainerApp struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -667,7 +916,7 @@ type ContainerAppAuthToken struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -797,6 +1046,9 @@ type ContainerAppProperties struct { // Deprecated. Resource ID of the Container App's environment. ManagedEnvironmentID *string + // Container App auto patch configuration. + PatchingConfiguration *ContainerAppPropertiesPatchingConfiguration + // Container App versioned application definition. Template *Template @@ -806,6 +1058,9 @@ type ContainerAppProperties struct { // READ-ONLY; Id used to verify domain name ownership CustomDomainVerificationID *string + // READ-ONLY; Any errors that occurred during deployment + DeploymentErrors *string + // READ-ONLY; The endpoint of the eventstream of the container app. EventStreamEndpoint *string @@ -825,6 +1080,14 @@ type ContainerAppProperties struct { ProvisioningState *ContainerAppProvisioningState } +// ContainerAppPropertiesPatchingConfiguration - Container App auto patch configuration. +type ContainerAppPropertiesPatchingConfiguration struct { + // Patching mode for the container app. Null or default in this field will be interpreted as Automatic by RP. Automatic mode + // will automatically apply available patches. Manual mode will require the user + // to manually apply patches. Disabled mode will stop patch detection and auto patching. + PatchingMode *PatchingMode +} + // ContainerAppSecret - Container App Secret. type ContainerAppSecret struct { // READ-ONLY; Resource ID of a managed identity to authenticate with Azure Key Vault, or System to use a system-assigned identity. @@ -840,6 +1103,121 @@ type ContainerAppSecret struct { Value *string } +// ContainerAppsBuildCollection - The response of a Container Apps Build Resource list operation. +type ContainerAppsBuildCollection struct { + // REQUIRED; The Container Apps Build Resource items on this page + Value []*ContainerAppsBuildResource + + // The link to the next page of items + NextLink *string +} + +// ContainerAppsBuildConfiguration - Configuration of the build. +type ContainerAppsBuildConfiguration struct { + // READ-ONLY; Base OS used to build and run the app. + BaseOs *string + + // READ-ONLY; List of environment variables to be passed to the build, secrets should not be used in environment variable. + EnvironmentVariables []*EnvironmentVariable + + // READ-ONLY; Platform to be used to build and run the app. + Platform *string + + // READ-ONLY; Platform version to be used to build and run the app. + PlatformVersion *string + + // READ-ONLY; List of steps to perform before the build. + PreBuildSteps []*PreBuildStep +} + +// ContainerAppsBuildProperties - The ContainerAppBuild properties. +type ContainerAppsBuildProperties struct { + // READ-ONLY; Status of the build once it has been provisioned. + BuildStatus *BuildStatus + + // READ-ONLY; Configuration of the build. + Configuration *ContainerAppsBuildConfiguration + + // READ-ONLY; Container registry that the final image will be uploaded to. + DestinationContainerRegistry *ContainerRegistryWithCustomImage + + // READ-ONLY; Endpoint from which the build logs can be streamed. + LogStreamEndpoint *string + + // READ-ONLY; Build provisioning state. + ProvisioningState *BuildProvisioningState +} + +// ContainerAppsBuildResource - Information pertaining to an individual build. +type ContainerAppsBuildResource struct { + // The resource-specific properties for this resource. + Properties *ContainerAppsBuildProperties + + // 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 +} + +// ContainerAppsPatchResource - Container App Patch +type ContainerAppsPatchResource struct { + // 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; Properties that describes current states of the patch resource. + Properties *PatchProperties + + // 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 +} + +// ContainerExecutionStatus - Container Apps Job execution container status. Contains status code and reason +type ContainerExecutionStatus struct { + // Additional information for the container status + AdditionalInformation *string + + // Exit code + Code *int32 + + // Container Name. + Name *string + + // Status of the container + Status *string +} + +// ContainerRegistry - Model representing a mapping from a container registry to the identity used to connect to it. +type ContainerRegistry struct { + // REQUIRED; Login server of the container registry. + ContainerRegistryServer *string + + // REQUIRED; Resource ID of the managed identity. + IdentityResourceID *string +} + +// ContainerRegistryWithCustomImage - Container registry that the final image will be uploaded to. +type ContainerRegistryWithCustomImage struct { + // REQUIRED; Login server of the container registry that the final image should be uploaded to. Builder resource needs to + // have this container registry defined along with an identity to use to access it. + Server *string + + // Full name that the final image should be uploaded as, including both image name and tag. + Image *string +} + // ContainerResources - Container App container resource requirements. type ContainerResources struct { // Required CPU in cores, e.g. 0.5 @@ -882,6 +1260,18 @@ type CorsPolicy struct { MaxAge *int32 } +// CustomContainerTemplate - Custom container configuration. +type CustomContainerTemplate struct { + // List of container definitions for the sessions of the session pool. + Containers []*SessionContainer + + // Session pool ingress configuration. + Ingress *SessionIngress + + // Private container registry credentials for containers used by the sessions of the session pool. + RegistryCredentials *SessionRegistryCredentials +} + // CustomDomain - Custom Domain of a Container App type CustomDomain struct { // REQUIRED; Hostname. @@ -896,6 +1286,9 @@ type CustomDomain struct { // CustomDomainConfiguration - Configuration properties for apps environment custom domain type CustomDomainConfiguration struct { + // Certificate stored in Azure Key Vault. + CertificateKeyVaultProperties *CertificateKeyVaultProperties + // Certificate password CertificatePassword *string @@ -1001,6 +1394,10 @@ type CustomScaleRule struct { // Authentication secrets for the custom scale rule. Auth []*ScaleRuleAuth + // The resource ID of a user-assigned managed identity that is assigned to the Container App, or 'system' for system-assigned + // identity. + Identity *string + // Metadata properties to describe custom scale rule. Metadata map[string]*string @@ -1041,7 +1438,7 @@ type DaprComponent struct { // Dapr Component resource specific properties Properties *DaprComponentProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -1077,10 +1474,111 @@ type DaprComponentProperties struct { // 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 } +// DaprComponentResiliencyPoliciesCollection - Dapr Component Resiliency Policies ARM resource. +type DaprComponentResiliencyPoliciesCollection struct { + // REQUIRED; Collection of resources. + Value []*DaprComponentResiliencyPolicy + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// DaprComponentResiliencyPolicy - Dapr Component Resiliency Policy. +type DaprComponentResiliencyPolicy struct { + // Dapr Component Resiliency Policy resource specific properties + Properties *DaprComponentResiliencyPolicyProperties + + // 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 +} + +// DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration - Dapr Component Resiliency Policy Circuit Breaker Policy +// Configuration. +type DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration struct { + // The number of consecutive errors before the circuit is opened. + ConsecutiveErrors *int32 + + // The optional interval in seconds after which the error count resets to 0. An interval of 0 will never reset. If not specified, + // the timeoutInSeconds value will be used. + IntervalInSeconds *int32 + + // The interval in seconds until a retry attempt is made after the circuit is opened. + TimeoutInSeconds *int32 +} + +// DaprComponentResiliencyPolicyConfiguration - Dapr Component Resiliency Policy Configuration. +type DaprComponentResiliencyPolicyConfiguration struct { + // The optional circuit breaker policy configuration + CircuitBreakerPolicy *DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + + // The optional HTTP retry policy configuration + HTTPRetryPolicy *DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration + + // The optional timeout policy configuration + TimeoutPolicy *DaprComponentResiliencyPolicyTimeoutPolicyConfiguration +} + +// DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration - Dapr Component Resiliency Policy HTTP Retry Backoff Configuration. +type DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration struct { + // The optional initial delay in milliseconds before an operation is retried + InitialDelayInMilliseconds *int32 + + // The optional maximum time interval in milliseconds between retry attempts + MaxIntervalInMilliseconds *int32 +} + +// DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration - Dapr Component Resiliency Policy HTTP Retry Policy Configuration. +type DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration struct { + // The optional maximum number of retries + MaxRetries *int32 + + // The optional retry backoff configuration + RetryBackOff *DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration +} + +// DaprComponentResiliencyPolicyProperties - Dapr Component Resiliency Policy resource specific properties +type DaprComponentResiliencyPolicyProperties struct { + // The optional inbound component resiliency policy configuration + InboundPolicy *DaprComponentResiliencyPolicyConfiguration + + // The optional outbound component resiliency policy configuration + OutboundPolicy *DaprComponentResiliencyPolicyConfiguration +} + +// DaprComponentResiliencyPolicyTimeoutPolicyConfiguration - Dapr Component Resiliency Policy Timeout Policy Configuration. +type DaprComponentResiliencyPolicyTimeoutPolicyConfiguration struct { + // The optional response timeout in seconds + ResponseTimeoutInSeconds *int32 +} + +// DaprComponentServiceBinding - Configuration to bind a Dapr Component to a dev ContainerApp Service +type DaprComponentServiceBinding struct { + // Service bind metadata + Metadata *DaprServiceBindMetadata + + // Name of the service bind + Name *string + + // Resource id of the target service + ServiceID *string +} + // DaprComponentsCollection - Dapr Components ARM resource. type DaprComponentsCollection struct { // REQUIRED; Collection of resources. @@ -1123,6 +1621,108 @@ type DaprSecretsCollection struct { Value []*DaprSecret } +// DaprServiceBindMetadata - Dapr component metadata. +type DaprServiceBindMetadata struct { + // Service bind metadata property name. + Name *string + + // Service bind metadata property value. + Value *string +} + +// DaprSubscription - Dapr PubSub Event Subscription. +type DaprSubscription struct { + // Dapr PubSub Event Subscription resource specific properties + Properties *DaprSubscriptionProperties + + // 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 +} + +// DaprSubscriptionBulkSubscribeOptions - Dapr PubSub Bulk Subscription Options. +type DaprSubscriptionBulkSubscribeOptions struct { + // Enable bulk subscription + Enabled *bool + + // Maximum duration in milliseconds to wait before a bulk message is sent to the app. + MaxAwaitDurationMs *int32 + + // Maximum number of messages to deliver in a bulk message. + MaxMessagesCount *int32 +} + +// DaprSubscriptionProperties - Dapr PubSub Event Subscription resource specific properties +type DaprSubscriptionProperties struct { + // Bulk subscription options + BulkSubscribe *DaprSubscriptionBulkSubscribeOptions + + // Deadletter topic name + DeadLetterTopic *string + + // Subscription metadata + Metadata map[string]*string + + // Dapr PubSub component name + PubsubName *string + + // Subscription routes + Routes *DaprSubscriptionRoutes + + // Application scopes to restrict the subscription to specific apps. + Scopes []*string + + // Topic name + Topic *string +} + +// DaprSubscriptionRouteRule - Dapr Pubsub Event Subscription Route Rule is used to specify the condition for sending a message +// to a specific path. +type DaprSubscriptionRouteRule struct { + // The optional CEL expression used to match the event. If the match is not specified, then the route is considered the default. + // The rules are tested in the order specified, so they should be define from + // most-to-least specific. The default route should appear last in the list. + Match *string + + // The path for events that match this rule + Path *string +} + +// DaprSubscriptionRoutes - Dapr PubSub Event Subscription Routes configuration. +type DaprSubscriptionRoutes struct { + // The default path to deliver events that do not match any of the rules. + Default *string + + // The list of Dapr PubSub Event Subscription Route Rules. + Rules []*DaprSubscriptionRouteRule +} + +// DaprSubscriptionsCollection - Dapr Subscriptions ARM resource. +type DaprSubscriptionsCollection struct { + // REQUIRED; Collection of resources. + Value []*DaprSubscription + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// DataDogConfiguration - Configuration of datadog +type DataDogConfiguration struct { + // The data dog api key + Key *string + + // The data dog site + Site *string +} + // DefaultAuthorizationPolicy - The configuration settings of the Azure Active Directory default authorization policy. type DefaultAuthorizationPolicy struct { // The configuration settings of the Azure Active Directory allowed applications. @@ -1168,6 +1768,15 @@ type DefaultErrorResponseErrorDetailsItem struct { Target *string } +// DestinationsConfiguration - Configuration of Open Telemetry destinations +type DestinationsConfiguration struct { + // Open telemetry datadog destination configuration + DataDogConfiguration *DataDogConfiguration + + // Open telemetry otlp configurations + OtlpConfigurations []*OtlpConfiguration +} + // DiagnosticDataProviderMetadata - Details of a diagnostics data provider type DiagnosticDataProviderMetadata struct { // Collection of properties @@ -1239,7 +1848,7 @@ type Diagnostics struct { // Diagnostics resource specific properties Properties *DiagnosticsProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -1324,6 +1933,75 @@ type DiagnosticsStatus struct { StatusID *int32 } +// DotNetComponent - .NET Component. +type DotNetComponent struct { + // .NET Component resource specific properties + Properties *DotNetComponentProperties + + // 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 +} + +// DotNetComponentConfigurationProperty - Configuration properties for a .NET Component +type DotNetComponentConfigurationProperty struct { + // The name of the property + PropertyName *string + + // The value of the property + Value *string +} + +// DotNetComponentProperties - .NET Component resource specific properties +type DotNetComponentProperties struct { + // Type of the .NET Component. + ComponentType *DotNetComponentType + + // List of .NET Components configuration properties + Configurations []*DotNetComponentConfigurationProperty + + // List of .NET Components that are bound to the .NET component + ServiceBinds []*DotNetComponentServiceBind + + // READ-ONLY; Provisioning state of the .NET Component. + ProvisioningState *DotNetComponentProvisioningState +} + +// DotNetComponentServiceBind - Configuration to bind a .NET Component to another .NET Component +type DotNetComponentServiceBind struct { + // Name of the service bind + Name *string + + // Resource id of the target service + ServiceID *string +} + +// DotNetComponentsCollection - .NET Components ARM resource. +type DotNetComponentsCollection struct { + // REQUIRED; Collection of resources. + Value []*DotNetComponent + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// DynamicPoolConfiguration - Dynamic pool configuration. +type DynamicPoolConfiguration struct { + // The cooldown period of a session in seconds. + CooldownPeriodInSeconds *int32 + + // The execution type of the session pool. + ExecutionType *ExecutionType +} + // EncryptionSettings - The configuration settings of the secrets references of encryption key and signing key for ContainerApp // Service Authentication/Authorization. type EncryptionSettings struct { @@ -1345,7 +2023,7 @@ type EnvironmentAuthToken struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -1379,6 +2057,15 @@ type EnvironmentVar struct { Value *string } +// EnvironmentVariable - Model representing an environment variable. +type EnvironmentVariable struct { + // REQUIRED; Environment variable name. + Name *string + + // REQUIRED; Environment variable value. + Value *string +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -1406,6 +2093,33 @@ type ErrorDetail struct { Target *string } +// ErrorEntity - Body of the error response returned from the API. +type ErrorEntity struct { + // Basic error code. + Code *string + + // Error Details. + Details []*ErrorEntity + + // Type of error. + ExtendedCode *string + + // Inner errors. + InnerErrors []*ErrorEntity + + // Any details of the error. + Message *string + + // Message template. + MessageTemplate *string + + // Parameters for the template. + Parameters []*string + + // The error target. + Target *string +} + // ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { @@ -1413,6 +2127,12 @@ type ErrorResponse struct { Error *ErrorDetail } +// ExecutionStatus - Container Apps Job execution status. +type ExecutionStatus struct { + // Replicas in the execution. + Replicas []*ReplicaExecutionStatus +} + // ExtendedLocation - The complex type of the extended location. type ExtendedLocation struct { // The name of the extended location. @@ -1466,9 +2186,15 @@ type GithubActionConfiguration struct { // AzureCredentials configurations. AzureCredentials *AzureCredentials + // List of environment variables to be passed to the build. + BuildEnvironmentVariables []*EnvironmentVariable + // Context path ContextPath *string + // Dockerfile path + DockerfilePath *string + // One time Github PAT to configure github environment GithubPersonalAccessToken *string @@ -1520,11 +2246,69 @@ type Google struct { Validation *AllowedAudiencesValidation } +// HTTPConnectionPool - Defines parameters for http connection pooling +type HTTPConnectionPool struct { + // Maximum number of pending http1 requests allowed + HTTP1MaxPendingRequests *int32 + + // Maximum number of http2 requests allowed + HTTP2MaxRequests *int32 +} + +// HTTPGet - Model representing a http get request. +type HTTPGet struct { + // REQUIRED; URL to make HTTP GET request against. + URL *string + + // Name of the file that the request should be saved to. + FileName *string + + // List of headers to send with the request. + Headers []*string +} + +// HTTPRetryPolicy - Policy that defines http request retry conditions +type HTTPRetryPolicy struct { + // Conditions that must be met for a request to be retried + Matches *HTTPRetryPolicyMatches + + // Maximum number of times a request will retry + MaxRetries *int32 + + // Settings for retry backoff characteristics + RetryBackOff *HTTPRetryPolicyRetryBackOff +} + +// HTTPRetryPolicyMatches - Conditions that must be met for a request to be retried +type HTTPRetryPolicyMatches struct { + // Errors that can trigger a retry + Errors []*string + + // Additional http status codes that can trigger a retry + HTTPStatusCodes []*int32 + + // Headers that must be present for a request to be retried + Headers []*HeaderMatch +} + +// HTTPRetryPolicyRetryBackOff - Settings for retry backoff characteristics +type HTTPRetryPolicyRetryBackOff struct { + // Initial delay, in milliseconds, before retrying a request + InitialDelayInMilliseconds *int64 + + // Maximum interval, in milliseconds, between retries + MaxIntervalInMilliseconds *int64 +} + // HTTPScaleRule - Container App container Http scaling rule. type HTTPScaleRule struct { // Authentication secrets for the custom scale rule. Auth []*ScaleRuleAuth + // The resource ID of a user-assigned managed identity that is assigned to the Container App, or 'system' for system-assigned + // identity. + Identity *string + // Metadata properties to describe http scale rule. Metadata map[string]*string } @@ -1548,6 +2332,39 @@ type HTTPSettingsRoutes struct { APIPrefix *string } +// Header of otlp configuration +type Header struct { + // The key of otlp configuration header + Key *string + + // The value of otlp configuration header + Value *string +} + +// HeaderMatch - Conditions required to match a header +type HeaderMatch struct { + // Name of the header + Header *string + + // Type of match to perform + Match *HeaderMatchMatch +} + +// HeaderMatchMatch - Type of match to perform +type HeaderMatchMatch struct { + // Exact value of the header + ExactMatch *string + + // Prefix value of the header + PrefixMatch *string + + // Regex value of the header + RegexMatch *string + + // Suffix value of the header + SuffixMatch *string +} + // IPSecurityRestrictionRule - Rule to restrict incoming IP address. type IPSecurityRestrictionRule struct { // REQUIRED; Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of ALL Allow or ALL Deny @@ -1592,6 +2409,16 @@ type IdentityProviders struct { Twitter *Twitter } +// IdentitySettings - Optional settings for a Managed Identity that is assigned to the Container App. +type IdentitySettings struct { + // REQUIRED; The resource ID of a user-assigned managed identity that is assigned to the Container App, or 'system' for system-assigned + // identity. + Identity *string + + // Use to select the lifecycle stages of a Container App during which the Managed Identity should be available. + Lifecycle *IdentitySettingsLifeCycle +} + // Ingress - Container App Ingress configuration. type Ingress struct { // Settings to expose additional ports on container app @@ -1627,6 +2454,9 @@ type Ingress struct { // Target Port in containers for traffic from ingress TargetPort *int32 + // Whether an http app listens on http or https + TargetPortHTTPScheme *IngressTargetPortHTTPScheme + // Traffic weights for app's revisions Traffic []*TrafficWeight @@ -1669,6 +2499,10 @@ type InitContainer struct { // Container image tag. Image *string + // The type of the image. Set to CloudBuild to let the system manages the image, where user will not be able to update image + // through image field. Set to ContainerImage for user provided image. + ImageType *ImageType + // Custom container name. Name *string @@ -1679,11 +2513,95 @@ type InitContainer struct { VolumeMounts []*VolumeMount } +// JavaComponent - Java Component. +type JavaComponent struct { + // Java Component resource specific properties + Properties JavaComponentPropertiesClassification + + // 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 +} + +// JavaComponentConfigurationProperty - Configuration properties for a Java Component +type JavaComponentConfigurationProperty struct { + // The name of the property + PropertyName *string + + // The value of the property + Value *string +} + +// JavaComponentIngress - Container App Ingress configuration. +type JavaComponentIngress struct { + // READ-ONLY; Hostname of the Java Component endpoint + Fqdn *string +} + +// JavaComponentProperties - Java Component common properties. +type JavaComponentProperties struct { + // REQUIRED; Type of the Java Component. + ComponentType *JavaComponentType + + // List of Java Components configuration properties + Configurations []*JavaComponentConfigurationProperty + + // Java component scaling configurations + Scale *JavaComponentPropertiesScale + + // List of Java Components that are bound to the Java component + ServiceBinds []*JavaComponentServiceBind + + // READ-ONLY; Provisioning state of the Java Component. + ProvisioningState *JavaComponentProvisioningState +} + +// GetJavaComponentProperties implements the JavaComponentPropertiesClassification interface for type JavaComponentProperties. +func (j *JavaComponentProperties) GetJavaComponentProperties() *JavaComponentProperties { return j } + +// JavaComponentPropertiesScale - Java component scaling configurations +type JavaComponentPropertiesScale struct { + // Optional. Maximum number of Java component replicas + MaxReplicas *int32 + + // Optional. Minimum number of Java component replicas. Defaults to 1 if not set + MinReplicas *int32 +} + +// JavaComponentServiceBind - Configuration to bind a Java Component to another Java Component +type JavaComponentServiceBind struct { + // Name of the service bind + Name *string + + // Resource id of the target service + ServiceID *string +} + +// JavaComponentsCollection - Java Components ARM resource. +type JavaComponentsCollection struct { + // REQUIRED; Collection of resources. + Value []*JavaComponent + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + // Job - Container App Job type Job struct { // REQUIRED; The geo-location where the resource lives Location *string + // The complex type of the extended location. + ExtendedLocation *ExtendedLocation + // Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials // in code. Identity *ManagedServiceIdentity @@ -1694,7 +2612,7 @@ type Job struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -1718,6 +2636,10 @@ type JobConfiguration struct { // Trigger configuration of an event driven job. EventTriggerConfig *JobConfigurationEventTriggerConfig + // Optional settings for Managed Identities that are assigned to the Container App Job. If a Managed Identity is not specified + // here, default settings will be used. + IdentitySettings []*IdentitySettings + // Manual trigger configuration for a single execution job. Properties replicaCompletionCount and parallelism would be set // to 1 by default ManualTriggerConfig *JobConfigurationManualTriggerConfig @@ -1824,6 +2746,9 @@ type JobExecutionNamesCollection struct { // JobExecutionProperties - Container Apps Job execution specific properties. type JobExecutionProperties struct { + // Detailed status of the job execution. + DetailedStatus *ExecutionStatus + // Job execution end time. EndTime *time.Time @@ -1848,6 +2773,9 @@ type JobExecutionTemplate struct { // JobPatchProperties - Container Apps Job resource specific properties. type JobPatchProperties struct { + // The complex type of the extended location. + ExtendedLocation *ExtendedLocation + // Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials // in code. Identity *ManagedServiceIdentity @@ -1896,6 +2824,9 @@ type JobProperties struct { // READ-ONLY; Provisioning state of the Container Apps Job. ProvisioningState *JobProvisioningState + + // READ-ONLY; Current running state of the job + RunningState *JobRunningState } // JobScale - Scaling configurations for event driven jobs. @@ -1918,6 +2849,9 @@ type JobScaleRule struct { // Authentication secrets for the scale rule. Auth []*ScaleRuleAuth + // The resource ID of a user-assigned managed identity that is assigned to the job, or 'system' for system-assigned identity. + Identity *string + // Metadata properties to describe the scale rule. Metadata any @@ -1985,10 +2919,40 @@ type LogAnalyticsConfiguration struct { // Log analytics customer id CustomerID *string + // Boolean indicating whether to parse json string log into dynamic json columns + DynamicJSONColumns *bool + // Log analytics customer key SharedKey *string } +// LoggerSetting - Logger settings for java workloads. +type LoggerSetting struct { + // REQUIRED; The specified logger's log level. + Level *Level + + // REQUIRED; Logger name. + Logger *string +} + +// LogicApp - A logic app extension resource +type LogicApp struct { + // The resource-specific properties for this resource. + Properties any + + // 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 +} + // Login - The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. type Login struct { // External URLs that can be redirected to as part of logging in or logging out of the app. Note that the query string part @@ -2024,6 +2988,12 @@ type LoginScopes struct { Scopes []*string } +// LogsConfiguration - Configuration of Open Telemetry logs +type LogsConfiguration struct { + // Open telemetry logs destinations + Destinations []*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 @@ -2035,7 +3005,7 @@ type ManagedCertificate struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2086,6 +3056,10 @@ type ManagedEnvironment struct { // REQUIRED; The geo-location where the resource lives Location *string + // Managed identities for the Managed Environment to interact with other Azure services without maintaining any secrets or + // credentials in code. + Identity *ManagedServiceIdentity + // Kind of the Environment. Kind *string @@ -2095,7 +3069,7 @@ type ManagedEnvironment struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2110,6 +3084,9 @@ type ManagedEnvironment struct { // ManagedEnvironmentProperties - Managed environment resource specific properties 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 AppLogsConfiguration *AppLogsConfiguration @@ -2134,12 +3111,18 @@ type ManagedEnvironmentProperties struct { // The configuration of Keda component. KedaConfiguration *KedaConfiguration + // Environment Open Telemetry configuration + OpenTelemetryConfiguration *OpenTelemetryConfiguration + // Peer authentication settings for the Managed Environment PeerAuthentication *ManagedEnvironmentPropertiesPeerAuthentication // Peer traffic settings for the Managed Environment PeerTrafficConfiguration *ManagedEnvironmentPropertiesPeerTrafficConfiguration + // Property to allow or block all public traffic. Allowed Values: 'Enabled', 'Disabled'. + PublicNetworkAccess *PublicNetworkAccess + // Vnet configuration for the environment VnetConfiguration *VnetConfiguration @@ -2158,6 +3141,9 @@ type ManagedEnvironmentProperties struct { // READ-ONLY; The endpoint of the eventstream of the Environment. EventStreamEndpoint *string + // READ-ONLY; Private endpoint connections to the resource. + PrivateEndpointConnections []*PrivateEndpointConnection + // READ-ONLY; Provisioning state of the Environment. ProvisioningState *EnvironmentProvisioningState @@ -2188,7 +3174,7 @@ type ManagedEnvironmentStorage struct { // Storage properties Properties *ManagedEnvironmentStorageProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2205,6 +3191,9 @@ type ManagedEnvironmentStorage struct { type ManagedEnvironmentStorageProperties struct { // Azure file properties AzureFile *AzureFileProperties + + // NFS Azure file properties + NfsAzureFile *NfsAzureFileProperties } // ManagedEnvironmentStoragesCollection - Collection of Storage for Environments @@ -2242,12 +3231,65 @@ type ManagedServiceIdentity struct { TenantID *string } +// MetricsConfiguration - Configuration of Open Telemetry metrics +type MetricsConfiguration struct { + // Open telemetry metrics destinations + Destinations []*string + + // Boolean indicating if including keda metrics + IncludeKeda *bool +} + // Mtls - Configuration properties for mutual TLS authentication type Mtls struct { // Boolean indicating whether the mutual TLS authentication is enabled Enabled *bool } +// NacosComponent - Nacos properties. +type NacosComponent struct { + // REQUIRED; Type of the Java Component. + ComponentType *JavaComponentType + + // List of Java Components configuration properties + Configurations []*JavaComponentConfigurationProperty + + // Java Component Ingress configurations. + Ingress *JavaComponentIngress + + // Java component scaling configurations + Scale *JavaComponentPropertiesScale + + // List of Java Components that are bound to the Java component + ServiceBinds []*JavaComponentServiceBind + + // READ-ONLY; Provisioning state of the Java Component. + ProvisioningState *JavaComponentProvisioningState +} + +// GetJavaComponentProperties implements the JavaComponentPropertiesClassification interface for type NacosComponent. +func (n *NacosComponent) GetJavaComponentProperties() *JavaComponentProperties { + return &JavaComponentProperties{ + ComponentType: n.ComponentType, + Configurations: n.Configurations, + ProvisioningState: n.ProvisioningState, + Scale: n.Scale, + ServiceBinds: n.ServiceBinds, + } +} + +// NfsAzureFileProperties - NFS Azure File Properties. +type NfsAzureFileProperties struct { + // Access mode for storage + AccessMode *AccessMode + + // Server for NFS azure file. + Server *string + + // NFS Azure file share name. + ShareName *string +} + // Nonce - The configuration settings of the nonce used in the login flow. type Nonce struct { // The time after the request is made when the nonce should expire. @@ -2305,6 +3347,21 @@ type OpenIDConnectRegistration struct { OpenIDConnectConfiguration *OpenIDConnectConfig } +// OpenTelemetryConfiguration - Configuration of Open Telemetry +type OpenTelemetryConfiguration struct { + // Open telemetry destinations configuration + DestinationsConfiguration *DestinationsConfiguration + + // Open telemetry logs configuration + LogsConfiguration *LogsConfiguration + + // Open telemetry metrics configuration + MetricsConfiguration *MetricsConfiguration + + // Open telemetry trace configuration + TracesConfiguration *TracesConfiguration +} + // OperationDetail - Operation detail payload type OperationDetail struct { // Display of the operation @@ -2335,10 +3392,227 @@ type OperationDisplay struct { Resource *string } +// OtlpConfiguration - Configuration of otlp +type OtlpConfiguration struct { + // The endpoint of otlp configuration + Endpoint *string + + // Headers of otlp configurations + Headers []*Header + + // Boolean indicating if otlp configuration is insecure + Insecure *bool + + // The name of otlp configuration + Name *string +} + +// PatchCollection - Container App patch collection +type PatchCollection struct { + // REQUIRED; Collection of patch resources. + Value []*ContainerAppsPatchResource + + // the link to the next page of items + NextLink *string +} + +// PatchDetails - The detailed info of patch operation performing when applying a patch. +type PatchDetails struct { + // READ-ONLY; The status of the patch detection. + DetectionStatus *DetectionStatus + + // READ-ONLY; The UTC timestamp that describes the latest detection was done. + LastDetectionTime *time.Time + + // READ-ONLY; The name of the target container for the patch. + TargetContainerName *string + + // READ-ONLY; The name of the target image for the patch. + TargetImage *string + + // READ-ONLY; The name of the new image created by the patch. + NewImageName *string + + // READ-ONLY; New layer update details in the target image. + NewLayer *PatchDetailsNewLayer + + // READ-ONLY; The old layer details in the target image. + OldLayer *PatchDetailsOldLayer + + // READ-ONLY; The type for the patch. + PatchType *PatchType +} + +// PatchDetailsNewLayer - New layer update details in the target image. +type PatchDetailsNewLayer struct { + // The framework and its version in the new run image for the target image. + FrameworkAndVersion *string + + // The details of the new layer for the target image. + Name *string + + // The OS name and its version in the new run image for the target image. + OSAndVersion *string +} + +// PatchDetailsOldLayer - The old layer details in the target image. +type PatchDetailsOldLayer struct { + // The framework and its version in the old run image for the target image. + FrameworkAndVersion *string + + // The details of the old layer for the target image. + Name *string + + // The OS name and its version in the old run image for the target image. + OSAndVersion *string +} + +// PatchProperties - Top level properties that describes current states of the patch resource +type PatchProperties struct { + // The Azure resource id of the target container app for the patch. + TargetContainerAppID *string + + // The Azure resource id of the target environment for the patch. + TargetEnvironmentID *string + + // The Azure resource id of the target revision for the patch. + TargetRevisionID *string + + // READ-ONLY; The UTC timestamp that describes when the patch object was created. + CreatedAt *time.Time + + // READ-ONLY; The UTC timestamp that describes when the patch object was last updated. + LastModifiedAt *time.Time + + // READ-ONLY; The status of the patch operation. + PatchApplyStatus *PatchApplyStatus + + // READ-ONLY; Detailed info describes the patch operation for the target container app. + PatchDetails []*PatchDetails +} + +// PatchSkipConfig - The configuration for patcher to skip a patch or not. +type PatchSkipConfig struct { + // The flag to indicate whether to skip the patch or not. + Skip *bool +} + +// PreBuildStep - Model representing a pre-build step. +type PreBuildStep struct { + // Description of the pre-build step. + Description *string + + // Http get request to send before the build. + HTTPGet *HTTPGet + + // List of custom commands to run. + Scripts []*string +} + +// PrivateEndpoint - The Private Endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for Private Endpoint + ID *string +} + +// PrivateEndpointConnection - The Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties + + // 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 +} + +// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified resource +type PrivateEndpointConnectionListResult struct { + // Array of private endpoint connections + Value []*PrivateEndpointConnection + + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string +} + +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The resource of private end point. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + // Resource properties. + Properties *PrivateLinkResourceProperties + + // 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 +} + +// PrivateLinkResourceListResult - A list of private link resources +type PrivateLinkResourceListResult struct { + // Array of private link resources + Value []*PrivateLinkResource + + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource private link DNS zone name. + RequiredZoneNames []*string + + // READ-ONLY; The private link resource group id. + GroupID *string + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer +// and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus +} + // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2353,9 +3627,16 @@ type ProxyResource struct { // QueueScaleRule - Container App container Azure Queue based scaling rule. type QueueScaleRule struct { + // Storage account name. required if using managed identity to authenticate + AccountName *string + // Authentication secrets for the queue scale rule. Auth []*ScaleRuleAuth + // The resource ID of a user-assigned managed identity that is assigned to the Container App, or 'system' for system-assigned + // identity. + Identity *string + // Queue length. QueueLength *int32 @@ -2396,7 +3677,7 @@ type Replica struct { // Replica resource specific properties Properties *ReplicaProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2432,6 +3713,9 @@ type ReplicaContainer struct { // The container start status Started *bool + // READ-ONLY; Container debug endpoint + DebugEndpoint *string + // READ-ONLY; Container exec endpoint ExecEndpoint *string @@ -2445,6 +3729,15 @@ type ReplicaContainer struct { RunningStateDetails *string } +// ReplicaExecutionStatus - Container Apps Job execution replica status. +type ReplicaExecutionStatus struct { + // Containers in the execution replica + Containers []*ContainerExecutionStatus + + // Replica Name. + Name *string +} + // ReplicaProperties - Replica resource specific properties type ReplicaProperties struct { // The containers collection under a replica. @@ -2465,7 +3758,7 @@ type ReplicaProperties struct { // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2483,7 +3776,7 @@ type Revision struct { // Revision resource specific properties Properties *RevisionProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2542,18 +3835,72 @@ type RevisionProperties struct { TrafficWeight *int32 } +// Runtime - Container App Runtime configuration. +type Runtime struct { + // .NET app configuration + Dotnet *RuntimeDotnet + + // Java app configuration + Java *RuntimeJava +} + +// RuntimeDotnet - .NET app configuration +type RuntimeDotnet struct { + // Auto configure the ASP.NET Core Data Protection feature + AutoConfigureDataProtection *bool +} + +// RuntimeJava - Java app configuration +type RuntimeJava struct { + // Enable jmx core metrics for the java app + EnableMetrics *bool + + // Diagnostic capabilities achieved by java agent + JavaAgent *RuntimeJavaAgent +} + +// RuntimeJavaAgent - Diagnostic capabilities achieved by java agent +type RuntimeJavaAgent struct { + // Enable java agent injection for the java app. + Enabled *bool + + // Capabilities on the java logging scenario. + Logging *RuntimeJavaAgentLogging +} + +// RuntimeJavaAgentLogging - Capabilities on the java logging scenario. +type RuntimeJavaAgentLogging struct { + // Settings of the logger for the java app. + LoggerSettings []*LoggerSetting +} + // Scale - Container App scaling configurations. type Scale struct { + // Optional. KEDA Cooldown Period. Defaults to 300 seconds if not set. + CooldownPeriod *int32 + // Optional. Maximum number of container replicas. Defaults to 10 if not set. MaxReplicas *int32 // Optional. Minimum number of container replicas. MinReplicas *int32 + // Optional. KEDA Polling Interval. Defaults to 30 seconds if not set. + PollingInterval *int32 + // Scaling rules. Rules []*ScaleRule } +// ScaleConfiguration - Scale configuration. +type ScaleConfiguration struct { + // The maximum count of sessions at the same time. + MaxConcurrentSessions *int32 + + // The minimum count of ready session instances. + ReadySessionInstances *int32 +} + // ScaleRule - Container App container scaling rule. type ScaleRule struct { // Azure Queue based scaling. @@ -2581,6 +3928,24 @@ type ScaleRuleAuth struct { TriggerParameter *string } +// ScgRoute - Spring Cloud Gateway route definition +type ScgRoute struct { + // REQUIRED; Id of the route + ID *string + + // REQUIRED; Uri of the route + URI *string + + // Filters of the route + Filters []*string + + // Order of the route + Order *int64 + + // Predicates of the route + Predicates []*string +} + // Secret definition. type Secret struct { // Resource ID of a managed identity to authenticate with Azure Key Vault, or System to use a system-assigned identity. @@ -2619,6 +3984,12 @@ type Service struct { // ServiceBind - Configuration to bind a ContainerApp to a dev ContainerApp Service type ServiceBind struct { + // Type of the client to be used to connect to the service + ClientType *string + + // Customized keys for customizing injected values to the app + CustomizedKeys map[string]*string + // Name of the service bind Name *string @@ -2626,12 +3997,193 @@ type ServiceBind struct { ServiceID *string } +// SessionContainer - Container definitions for the sessions of the session pool. +type SessionContainer struct { + // Container start command arguments. + Args []*string + + // Container start command. + Command []*string + + // Container environment variables. + Env []*EnvironmentVar + + // Container image tag. + Image *string + + // Custom container name. + Name *string + + // Container resource requirements. + Resources *SessionContainerResources +} + +// SessionContainerResources - Container resource requirements for sessions of the session pool. +type SessionContainerResources struct { + // Required CPU in cores, e.g. 0.5 + CPU *float64 + + // Required memory, e.g. "250Mb" + Memory *string +} + +// SessionIngress - Session pool ingress configuration. +type SessionIngress struct { + // Target port in containers for traffic from ingress + TargetPort *int32 +} + +// SessionNetworkConfiguration - Session network configuration. +type SessionNetworkConfiguration struct { + // Network status for the sessions. + Status *SessionNetworkStatus +} + +// SessionPool - Container App session pool. +type SessionPool struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Container App session pool resource specific properties + Properties *SessionPoolProperties + + // Resource tags. + Tags map[string]*string + + // 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 +} + +// SessionPoolCollection - Session pool collection Azure resource. +type SessionPoolCollection struct { + // REQUIRED; Collection of resources. + Value []*SessionPool + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// SessionPoolProperties - Container App session pool resource specific properties +type SessionPoolProperties struct { + // The container type of the sessions. + ContainerType *ContainerType + + // The custom container configuration if the containerType is CustomContainer. + CustomContainerTemplate *CustomContainerTemplate + + // The pool configuration if the poolManagementType is dynamic. + DynamicPoolConfiguration *DynamicPoolConfiguration + + // Resource ID of the session pool's environment. + EnvironmentID *string + + // The pool management type of the session pool. + PoolManagementType *PoolManagementType + + // The scale configuration of the session pool. + ScaleConfiguration *ScaleConfiguration + + // The secrets of the session pool. + Secrets []*SessionPoolSecret + + // The network configuration of the sessions in the session pool. + SessionNetworkConfiguration *SessionNetworkConfiguration + + // READ-ONLY; The number of nodes the session pool is using. + NodeCount *int32 + + // READ-ONLY; The endpoint to manage the pool. + PoolManagementEndpoint *string + + // READ-ONLY; Provisioning state of the session pool. + ProvisioningState *SessionPoolProvisioningState +} + +// SessionPoolSecret - Secret definition. +type SessionPoolSecret struct { + // Secret Name. + Name *string + + // Secret Value. + Value *string +} + +// SessionPoolUpdatableProperties - Container App session pool updatable properties. +type SessionPoolUpdatableProperties struct { + // Session pool resource specific updatable properties. + Properties *SessionPoolUpdatablePropertiesProperties +} + +// SessionPoolUpdatablePropertiesProperties - Session pool resource specific updatable properties. +type SessionPoolUpdatablePropertiesProperties struct { + // The custom container configuration if the containerType is CustomContainer. + CustomContainerTemplate *CustomContainerTemplate + + // The pool configuration if the poolManagementType is dynamic. + DynamicPoolConfiguration *DynamicPoolConfiguration + + // The scale configuration of the session pool. + ScaleConfiguration *ScaleConfiguration + + // The secrets of the session pool. + Secrets []*SessionPoolSecret + + // The network configuration of the sessions in the session pool. + SessionNetworkConfiguration *SessionNetworkConfiguration +} + +// SessionRegistryCredentials - Session pool private registry credentials. +type SessionRegistryCredentials struct { + // A Managed Identity to use to authenticate with Azure Container Registry. For user-assigned identities, use the full user-assigned + // identity Resource ID. For system-assigned identities, use 'system' + Identity *string + + // The name of the secret that contains the registry login password + PasswordSecretRef *string + + // Container registry server. + Server *string + + // Container registry username. + Username *string +} + +// SmbStorage - SMB storage properties +type SmbStorage struct { + // Access mode for storage + AccessMode *AccessMode + + // The domain name for the user. + Domain *string + + // The host name or IP address of the SMB server. + Host *string + + // The password for the user. + Password *string + + // The path to the SMB shared folder. + ShareName *string + + // The user to log on to the SMB server. + Username *string +} + // SourceControl - Container App SourceControl. type SourceControl struct { // SourceControl resource specific properties Properties *SourceControlProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2669,6 +4221,134 @@ type SourceControlProperties struct { OperationState *SourceControlOperationState } +// SpringBootAdminComponent - Spring Boot Admin properties. +type SpringBootAdminComponent struct { + // REQUIRED; Type of the Java Component. + ComponentType *JavaComponentType + + // List of Java Components configuration properties + Configurations []*JavaComponentConfigurationProperty + + // Java Component Ingress configurations. + Ingress *JavaComponentIngress + + // Java component scaling configurations + Scale *JavaComponentPropertiesScale + + // List of Java Components that are bound to the Java component + ServiceBinds []*JavaComponentServiceBind + + // READ-ONLY; Provisioning state of the Java Component. + ProvisioningState *JavaComponentProvisioningState +} + +// GetJavaComponentProperties implements the JavaComponentPropertiesClassification interface for type SpringBootAdminComponent. +func (s *SpringBootAdminComponent) GetJavaComponentProperties() *JavaComponentProperties { + return &JavaComponentProperties{ + ComponentType: s.ComponentType, + Configurations: s.Configurations, + ProvisioningState: s.ProvisioningState, + Scale: s.Scale, + ServiceBinds: s.ServiceBinds, + } +} + +// SpringCloudConfigComponent - Spring Cloud Config properties. +type SpringCloudConfigComponent struct { + // REQUIRED; Type of the Java Component. + ComponentType *JavaComponentType + + // List of Java Components configuration properties + Configurations []*JavaComponentConfigurationProperty + + // Java component scaling configurations + Scale *JavaComponentPropertiesScale + + // List of Java Components that are bound to the Java component + ServiceBinds []*JavaComponentServiceBind + + // READ-ONLY; Provisioning state of the Java Component. + ProvisioningState *JavaComponentProvisioningState +} + +// GetJavaComponentProperties implements the JavaComponentPropertiesClassification interface for type SpringCloudConfigComponent. +func (s *SpringCloudConfigComponent) GetJavaComponentProperties() *JavaComponentProperties { + return &JavaComponentProperties{ + ComponentType: s.ComponentType, + Configurations: s.Configurations, + ProvisioningState: s.ProvisioningState, + Scale: s.Scale, + ServiceBinds: s.ServiceBinds, + } +} + +// SpringCloudEurekaComponent - Spring Cloud Eureka properties. +type SpringCloudEurekaComponent struct { + // REQUIRED; Type of the Java Component. + ComponentType *JavaComponentType + + // List of Java Components configuration properties + Configurations []*JavaComponentConfigurationProperty + + // Java Component Ingress configurations. + Ingress *JavaComponentIngress + + // Java component scaling configurations + Scale *JavaComponentPropertiesScale + + // List of Java Components that are bound to the Java component + ServiceBinds []*JavaComponentServiceBind + + // READ-ONLY; Provisioning state of the Java Component. + ProvisioningState *JavaComponentProvisioningState +} + +// GetJavaComponentProperties implements the JavaComponentPropertiesClassification interface for type SpringCloudEurekaComponent. +func (s *SpringCloudEurekaComponent) GetJavaComponentProperties() *JavaComponentProperties { + return &JavaComponentProperties{ + ComponentType: s.ComponentType, + Configurations: s.Configurations, + ProvisioningState: s.ProvisioningState, + Scale: s.Scale, + ServiceBinds: s.ServiceBinds, + } +} + +// SpringCloudGatewayComponent - Spring Cloud Gateway properties. +type SpringCloudGatewayComponent struct { + // REQUIRED; Type of the Java Component. + ComponentType *JavaComponentType + + // List of Java Components configuration properties + Configurations []*JavaComponentConfigurationProperty + + // Java Component Ingress configurations. + Ingress *JavaComponentIngress + + // Java component scaling configurations + Scale *JavaComponentPropertiesScale + + // List of Java Components that are bound to the Java component + ServiceBinds []*JavaComponentServiceBind + + // Gateway route definition + SpringCloudGatewayRoutes []*ScgRoute + + // READ-ONLY; Provisioning state of the Java Component. + ProvisioningState *JavaComponentProvisioningState +} + +// GetJavaComponentProperties implements the JavaComponentPropertiesClassification interface for type SpringCloudGatewayComponent. +func (s *SpringCloudGatewayComponent) GetJavaComponentProperties() *JavaComponentProperties { + return &JavaComponentProperties{ + ComponentType: s.ComponentType, + Configurations: s.Configurations, + ProvisioningState: s.ProvisioningState, + Scale: s.Scale, + ServiceBinds: s.ServiceBinds, + } +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -2690,11 +4370,27 @@ type SystemData struct { LastModifiedByType *CreatedByType } +// TCPConnectionPool - Defines parameters for tcp connection pooling +type TCPConnectionPool struct { + // Maximum number of tcp connections allowed + MaxConnections *int32 +} + +// TCPRetryPolicy - Policy that defines tcp request retry conditions +type TCPRetryPolicy struct { + // Maximum number of attempts to connect to the tcp service + MaxConnectAttempts *int32 +} + // TCPScaleRule - Container App container Tcp scaling rule. type TCPScaleRule struct { // Authentication secrets for the tcp scale rule. Auth []*ScaleRuleAuth + // The resource ID of a user-assigned managed identity that is assigned to the Container App, or 'system' for system-assigned + // identity. + Identity *string + // Metadata properties to describe tcp scale rule. Metadata map[string]*string } @@ -2727,6 +4423,15 @@ type Template struct { Volumes []*Volume } +// TimeoutPolicy - Policy to set request timeouts +type TimeoutPolicy struct { + // Timeout, in seconds, for a request to initiate a connection + ConnectionTimeoutInSeconds *int32 + + // Timeout, in seconds, for a request to respond + ResponseTimeoutInSeconds *int32 +} + // TokenStore - The configuration settings of the token store. type TokenStore struct { // The configuration settings of the storage of the tokens if blob storage is used. @@ -2741,6 +4446,15 @@ type TokenStore struct { TokenRefreshExtensionHours *float64 } +// TracesConfiguration - Configuration of Open Telemetry traces +type TracesConfiguration struct { + // Open telemetry traces destinations + Destinations []*string + + // Boolean indicating if including dapr traces + IncludeDapr *bool +} + // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { @@ -2750,7 +4464,7 @@ type TrackedResource struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 @@ -2852,7 +4566,7 @@ type VnetConfiguration struct { // Volume definitions for the Container App. type Volume struct { - // Mount options used while mounting the AzureFile. Must be a comma-separated string. + // Mount options used while mounting the Azure file share or NFS Azure file share. Must be a comma-separated string. MountOptions *string // Volume name. @@ -2880,6 +4594,69 @@ type VolumeMount struct { VolumeName *string } +// WorkflowArtifacts - The workflow filter. +type WorkflowArtifacts struct { + // Application settings of the workflow. + AppSettings any + + // Files of the app. + Files any + + // Files of the app to delete. + FilesToDelete []*string +} + +// WorkflowEnvelope - Workflow properties definition. +type WorkflowEnvelope struct { + // The resource kind. + Kind *string + + // The resource location. + Location *string + + // Additional workflow properties. + Properties *WorkflowEnvelopeProperties + + // READ-ONLY; The resource id. + ID *string + + // READ-ONLY; Gets the resource name. + Name *string + + // READ-ONLY; Gets the resource type. + Type *string +} + +// WorkflowEnvelopeCollection - Collection of workflow information elements. +type WorkflowEnvelopeCollection struct { + // REQUIRED; Collection of resources. + Value []*WorkflowEnvelope + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// WorkflowEnvelopeProperties - Additional workflow properties. +type WorkflowEnvelopeProperties struct { + // Gets or sets the files. + Files any + + // Gets or sets the state of the workflow. + FlowState *WorkflowState + + // Gets or sets workflow health. + Health *WorkflowHealth +} + +// WorkflowHealth - Represents the workflow health. +type WorkflowHealth struct { + // REQUIRED; Gets or sets the workflow health state. + State *WorkflowHealthState + + // Gets or sets the workflow error. + Error *ErrorEntity +} + // WorkloadProfile - Workload profile to scope container app execution. type WorkloadProfile struct { // REQUIRED; Workload profile type for the workloads to run on. @@ -2888,6 +4665,9 @@ type WorkloadProfile struct { // REQUIRED; Workload profile type for the workloads to run on. WorkloadProfileType *string + // Whether to use a FIPS-enabled OS. Supported only for dedicated workload profiles. + EnableFips *bool + // The maximum capacity. MaximumCount *int32 @@ -2900,7 +4680,7 @@ type WorkloadProfileStates struct { // Workload Profile resource specific properties. Properties *WorkloadProfileStatesProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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 diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go b/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go index e4b8063749..18fc9972a2 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/models_serde.go @@ -11,9 +11,10 @@ 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. @@ -74,6 +75,33 @@ func (a *AllowedPrincipals) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AppInsightsConfiguration. +func (a AppInsightsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionString", a.ConnectionString) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppInsightsConfiguration. +func (a *AppInsightsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionString": + err = unpopulate(val, "ConnectionString", &a.ConnectionString) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AppLogsConfiguration. func (a AppLogsConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -136,6 +164,127 @@ func (a *AppRegistration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AppResiliency. +func (a AppResiliency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppResiliency. +func (a *AppResiliency) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AppResiliencyCollection. +func (a AppResiliencyCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppResiliencyCollection. +func (a *AppResiliencyCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AppResiliencyProperties. +func (a AppResiliencyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "circuitBreakerPolicy", a.CircuitBreakerPolicy) + populate(objectMap, "httpConnectionPool", a.HTTPConnectionPool) + populate(objectMap, "httpRetryPolicy", a.HTTPRetryPolicy) + populate(objectMap, "tcpConnectionPool", a.TCPConnectionPool) + populate(objectMap, "tcpRetryPolicy", a.TCPRetryPolicy) + populate(objectMap, "timeoutPolicy", a.TimeoutPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppResiliencyProperties. +func (a *AppResiliencyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "circuitBreakerPolicy": + err = unpopulate(val, "CircuitBreakerPolicy", &a.CircuitBreakerPolicy) + delete(rawMsg, key) + case "httpConnectionPool": + err = unpopulate(val, "HTTPConnectionPool", &a.HTTPConnectionPool) + delete(rawMsg, key) + case "httpRetryPolicy": + err = unpopulate(val, "HTTPRetryPolicy", &a.HTTPRetryPolicy) + delete(rawMsg, key) + case "tcpConnectionPool": + err = unpopulate(val, "TCPConnectionPool", &a.TCPConnectionPool) + delete(rawMsg, key) + case "tcpRetryPolicy": + err = unpopulate(val, "TCPRetryPolicy", &a.TCPRetryPolicy) + delete(rawMsg, key) + case "timeoutPolicy": + err = unpopulate(val, "TimeoutPolicy", &a.TimeoutPolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Apple. func (a Apple) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -813,6 +962,7 @@ func (b BaseContainer) MarshalJSON() ([]byte, error) { populate(objectMap, "command", b.Command) populate(objectMap, "env", b.Env) populate(objectMap, "image", b.Image) + populate(objectMap, "imageType", b.ImageType) populate(objectMap, "name", b.Name) populate(objectMap, "resources", b.Resources) populate(objectMap, "volumeMounts", b.VolumeMounts) @@ -840,6 +990,9 @@ func (b *BaseContainer) UnmarshalJSON(data []byte) error { case "image": err = unpopulate(val, "Image", &b.Image) delete(rawMsg, key) + case "imageType": + err = unpopulate(val, "ImageType", &b.ImageType) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &b.Name) delete(rawMsg, key) @@ -993,6 +1146,388 @@ func (b *BlobStorageTokenStore) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BuildCollection. +func (b BuildCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuildCollection. +func (b *BuildCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuildConfiguration. +func (b BuildConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseOs", b.BaseOs) + populate(objectMap, "environmentVariables", b.EnvironmentVariables) + populate(objectMap, "platform", b.Platform) + populate(objectMap, "platformVersion", b.PlatformVersion) + populate(objectMap, "preBuildSteps", b.PreBuildSteps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuildConfiguration. +func (b *BuildConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseOs": + err = unpopulate(val, "BaseOs", &b.BaseOs) + delete(rawMsg, key) + case "environmentVariables": + err = unpopulate(val, "EnvironmentVariables", &b.EnvironmentVariables) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &b.Platform) + delete(rawMsg, key) + case "platformVersion": + err = unpopulate(val, "PlatformVersion", &b.PlatformVersion) + delete(rawMsg, key) + case "preBuildSteps": + err = unpopulate(val, "PreBuildSteps", &b.PreBuildSteps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuildProperties. +func (b BuildProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "buildStatus", b.BuildStatus) + populate(objectMap, "configuration", b.Configuration) + populate(objectMap, "destinationContainerRegistry", b.DestinationContainerRegistry) + populate(objectMap, "logStreamEndpoint", b.LogStreamEndpoint) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "tokenEndpoint", b.TokenEndpoint) + populate(objectMap, "uploadEndpoint", b.UploadEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuildProperties. +func (b *BuildProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "buildStatus": + err = unpopulate(val, "BuildStatus", &b.BuildStatus) + delete(rawMsg, key) + case "configuration": + err = unpopulate(val, "Configuration", &b.Configuration) + delete(rawMsg, key) + case "destinationContainerRegistry": + err = unpopulate(val, "DestinationContainerRegistry", &b.DestinationContainerRegistry) + delete(rawMsg, key) + case "logStreamEndpoint": + err = unpopulate(val, "LogStreamEndpoint", &b.LogStreamEndpoint) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + case "tokenEndpoint": + err = unpopulate(val, "TokenEndpoint", &b.TokenEndpoint) + delete(rawMsg, key) + case "uploadEndpoint": + err = unpopulate(val, "UploadEndpoint", &b.UploadEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuildResource. +func (b BuildResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuildResource. +func (b *BuildResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuildToken. +func (b BuildToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "expires", b.Expires) + populate(objectMap, "token", b.Token) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuildToken. +func (b *BuildToken) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expires": + err = unpopulateDateTimeRFC3339(val, "Expires", &b.Expires) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &b.Token) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuilderCollection. +func (b BuilderCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuilderCollection. +func (b *BuilderCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuilderProperties. +func (b BuilderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "containerRegistries", b.ContainerRegistries) + populate(objectMap, "environmentId", b.EnvironmentID) + populate(objectMap, "provisioningState", b.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuilderProperties. +func (b *BuilderProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "containerRegistries": + err = unpopulate(val, "ContainerRegistries", &b.ContainerRegistries) + delete(rawMsg, key) + case "environmentId": + err = unpopulate(val, "EnvironmentID", &b.EnvironmentID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuilderResource. +func (b BuilderResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "identity", b.Identity) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuilderResource. +func (b *BuilderResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &b.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &b.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuilderResourceUpdate. +func (b BuilderResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", b.Identity) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "tags", b.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuilderResourceUpdate. +func (b *BuilderResourceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &b.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BuilderResourceUpdateProperties. +func (b BuilderResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "environmentId", b.EnvironmentID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuilderResourceUpdateProperties. +func (b *BuilderResourceUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "environmentId": + err = unpopulate(val, "EnvironmentID", &b.EnvironmentID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Certificate. func (c Certificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1075,6 +1610,37 @@ func (c *CertificateCollection) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CertificateKeyVaultProperties. +func (c CertificateKeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "keyVaultUrl", c.KeyVaultURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateKeyVaultProperties. +func (c *CertificateKeyVaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "keyVaultUrl": + err = unpopulate(val, "KeyVaultURL", &c.KeyVaultURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CertificatePatch. func (c CertificatePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1105,6 +1671,8 @@ func (c *CertificatePatch) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CertificateProperties. func (c CertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "certificateKeyVaultProperties", c.CertificateKeyVaultProperties) + populate(objectMap, "certificateType", c.CertificateType) populateDateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) populateDateTimeRFC3339(objectMap, "issueDate", c.IssueDate) populate(objectMap, "issuer", c.Issuer) @@ -1130,6 +1698,12 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "certificateKeyVaultProperties": + err = unpopulate(val, "CertificateKeyVaultProperties", &c.CertificateKeyVaultProperties) + delete(rawMsg, key) + case "certificateType": + err = unpopulate(val, "CertificateType", &c.CertificateType) + delete(rawMsg, key) case "expirationDate": err = unpopulateDateTimeRFC3339(val, "ExpirationDate", &c.ExpirationDate) delete(rawMsg, key) @@ -1239,6 +1813,41 @@ func (c *CheckNameAvailabilityResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CircuitBreakerPolicy. +func (c CircuitBreakerPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "consecutiveErrors", c.ConsecutiveErrors) + populate(objectMap, "intervalInSeconds", c.IntervalInSeconds) + populate(objectMap, "maxEjectionPercent", c.MaxEjectionPercent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CircuitBreakerPolicy. +func (c *CircuitBreakerPolicy) UnmarshalJSON(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 "consecutiveErrors": + err = unpopulate(val, "ConsecutiveErrors", &c.ConsecutiveErrors) + delete(rawMsg, key) + case "intervalInSeconds": + err = unpopulate(val, "IntervalInSeconds", &c.IntervalInSeconds) + delete(rawMsg, key) + case "maxEjectionPercent": + err = unpopulate(val, "MaxEjectionPercent", &c.MaxEjectionPercent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ClientRegistration. func (c ClientRegistration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1275,9 +1884,11 @@ func (c Configuration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "activeRevisionsMode", c.ActiveRevisionsMode) populate(objectMap, "dapr", c.Dapr) + populate(objectMap, "identitySettings", c.IdentitySettings) populate(objectMap, "ingress", c.Ingress) populate(objectMap, "maxInactiveRevisions", c.MaxInactiveRevisions) populate(objectMap, "registries", c.Registries) + populate(objectMap, "runtime", c.Runtime) populate(objectMap, "secrets", c.Secrets) populate(objectMap, "service", c.Service) return json.Marshal(objectMap) @@ -1298,6 +1909,9 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { case "dapr": err = unpopulate(val, "Dapr", &c.Dapr) delete(rawMsg, key) + case "identitySettings": + err = unpopulate(val, "IdentitySettings", &c.IdentitySettings) + delete(rawMsg, key) case "ingress": err = unpopulate(val, "Ingress", &c.Ingress) delete(rawMsg, key) @@ -1307,6 +1921,9 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { case "registries": err = unpopulate(val, "Registries", &c.Registries) delete(rawMsg, key) + case "runtime": + err = unpopulate(val, "Runtime", &c.Runtime) + delete(rawMsg, key) case "secrets": err = unpopulate(val, "Secrets", &c.Secrets) delete(rawMsg, key) @@ -1501,6 +2118,7 @@ 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, "smb", c.Smb) return json.Marshal(objectMap) } @@ -1516,6 +2134,9 @@ func (c *ConnectedEnvironmentStorageProperties) UnmarshalJSON(data []byte) error case "azureFile": err = unpopulate(val, "AzureFile", &c.AzureFile) delete(rawMsg, key) + case "smb": + err = unpopulate(val, "Smb", &c.Smb) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1558,6 +2179,7 @@ func (c Container) MarshalJSON() ([]byte, error) { populate(objectMap, "command", c.Command) populate(objectMap, "env", c.Env) populate(objectMap, "image", c.Image) + populate(objectMap, "imageType", c.ImageType) populate(objectMap, "name", c.Name) populate(objectMap, "probes", c.Probes) populate(objectMap, "resources", c.Resources) @@ -1586,6 +2208,9 @@ func (c *Container) UnmarshalJSON(data []byte) error { case "image": err = unpopulate(val, "Image", &c.Image) delete(rawMsg, key) + case "imageType": + err = unpopulate(val, "ImageType", &c.ImageType) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) @@ -1612,6 +2237,7 @@ func (c ContainerApp) MarshalJSON() ([]byte, error) { populate(objectMap, "extendedLocation", c.ExtendedLocation) populate(objectMap, "id", c.ID) populate(objectMap, "identity", c.Identity) + populate(objectMap, "kind", c.Kind) populate(objectMap, "location", c.Location) populate(objectMap, "managedBy", c.ManagedBy) populate(objectMap, "name", c.Name) @@ -1640,6 +2266,9 @@ func (c *ContainerApp) UnmarshalJSON(data []byte) error { case "identity": err = unpopulate(val, "Identity", &c.Identity) delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) @@ -1982,6 +2611,7 @@ func (c ContainerAppProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "configuration", c.Configuration) populate(objectMap, "customDomainVerificationId", c.CustomDomainVerificationID) + populate(objectMap, "deploymentErrors", c.DeploymentErrors) populate(objectMap, "environmentId", c.EnvironmentID) populate(objectMap, "eventStreamEndpoint", c.EventStreamEndpoint) populate(objectMap, "latestReadyRevisionName", c.LatestReadyRevisionName) @@ -1989,6 +2619,7 @@ func (c ContainerAppProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "latestRevisionName", c.LatestRevisionName) populate(objectMap, "managedEnvironmentId", c.ManagedEnvironmentID) populate(objectMap, "outboundIpAddresses", c.OutboundIPAddresses) + populate(objectMap, "patchingConfiguration", c.PatchingConfiguration) populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "template", c.Template) populate(objectMap, "workloadProfileName", c.WorkloadProfileName) @@ -2010,6 +2641,9 @@ func (c *ContainerAppProperties) UnmarshalJSON(data []byte) error { case "customDomainVerificationId": err = unpopulate(val, "CustomDomainVerificationID", &c.CustomDomainVerificationID) delete(rawMsg, key) + case "deploymentErrors": + err = unpopulate(val, "DeploymentErrors", &c.DeploymentErrors) + delete(rawMsg, key) case "environmentId": err = unpopulate(val, "EnvironmentID", &c.EnvironmentID) delete(rawMsg, key) @@ -2031,6 +2665,9 @@ func (c *ContainerAppProperties) UnmarshalJSON(data []byte) error { case "outboundIpAddresses": err = unpopulate(val, "OutboundIPAddresses", &c.OutboundIPAddresses) delete(rawMsg, key) + case "patchingConfiguration": + err = unpopulate(val, "PatchingConfiguration", &c.PatchingConfiguration) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) @@ -2048,6 +2685,33 @@ func (c *ContainerAppProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ContainerAppPropertiesPatchingConfiguration. +func (c ContainerAppPropertiesPatchingConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "patchingMode", c.PatchingMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppPropertiesPatchingConfiguration. +func (c *ContainerAppPropertiesPatchingConfiguration) UnmarshalJSON(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 "patchingMode": + err = unpopulate(val, "PatchingMode", &c.PatchingMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ContainerAppSecret. func (c ContainerAppSecret) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2087,6 +2751,310 @@ func (c *ContainerAppSecret) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ContainerAppsBuildCollection. +func (c ContainerAppsBuildCollection) 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 ContainerAppsBuildCollection. +func (c *ContainerAppsBuildCollection) UnmarshalJSON(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 ContainerAppsBuildConfiguration. +func (c ContainerAppsBuildConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseOs", c.BaseOs) + populate(objectMap, "environmentVariables", c.EnvironmentVariables) + populate(objectMap, "platform", c.Platform) + populate(objectMap, "platformVersion", c.PlatformVersion) + populate(objectMap, "preBuildSteps", c.PreBuildSteps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppsBuildConfiguration. +func (c *ContainerAppsBuildConfiguration) UnmarshalJSON(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 "baseOs": + err = unpopulate(val, "BaseOs", &c.BaseOs) + delete(rawMsg, key) + case "environmentVariables": + err = unpopulate(val, "EnvironmentVariables", &c.EnvironmentVariables) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &c.Platform) + delete(rawMsg, key) + case "platformVersion": + err = unpopulate(val, "PlatformVersion", &c.PlatformVersion) + delete(rawMsg, key) + case "preBuildSteps": + err = unpopulate(val, "PreBuildSteps", &c.PreBuildSteps) + 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 ContainerAppsBuildProperties. +func (c ContainerAppsBuildProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "buildStatus", c.BuildStatus) + populate(objectMap, "configuration", c.Configuration) + populate(objectMap, "destinationContainerRegistry", c.DestinationContainerRegistry) + populate(objectMap, "logStreamEndpoint", c.LogStreamEndpoint) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAppsBuildProperties. +func (c *ContainerAppsBuildProperties) UnmarshalJSON(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 "buildStatus": + err = unpopulate(val, "BuildStatus", &c.BuildStatus) + delete(rawMsg, key) + case "configuration": + err = unpopulate(val, "Configuration", &c.Configuration) + delete(rawMsg, key) + case "destinationContainerRegistry": + err = unpopulate(val, "DestinationContainerRegistry", &c.DestinationContainerRegistry) + delete(rawMsg, key) + case "logStreamEndpoint": + err = unpopulate(val, "LogStreamEndpoint", &c.LogStreamEndpoint) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + 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 ContainerAppsBuildResource. +func (c ContainerAppsBuildResource) 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 ContainerAppsBuildResource. +func (c *ContainerAppsBuildResource) UnmarshalJSON(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 ContainerAppsPatchResource. +func (c ContainerAppsPatchResource) 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 ContainerAppsPatchResource. +func (c *ContainerAppsPatchResource) UnmarshalJSON(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 ContainerExecutionStatus. +func (c ContainerExecutionStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInformation", c.AdditionalInformation) + populate(objectMap, "code", c.Code) + populate(objectMap, "name", c.Name) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerExecutionStatus. +func (c *ContainerExecutionStatus) UnmarshalJSON(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 "additionalInformation": + err = unpopulate(val, "AdditionalInformation", &c.AdditionalInformation) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + 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 ContainerRegistry. +func (c ContainerRegistry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "containerRegistryServer", c.ContainerRegistryServer) + populate(objectMap, "identityResourceId", c.IdentityResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistry. +func (c *ContainerRegistry) UnmarshalJSON(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 "containerRegistryServer": + err = unpopulate(val, "ContainerRegistryServer", &c.ContainerRegistryServer) + delete(rawMsg, key) + case "identityResourceId": + err = unpopulate(val, "IdentityResourceID", &c.IdentityResourceID) + 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 ContainerRegistryWithCustomImage. +func (c ContainerRegistryWithCustomImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "image", c.Image) + populate(objectMap, "server", c.Server) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistryWithCustomImage. +func (c *ContainerRegistryWithCustomImage) UnmarshalJSON(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 "image": + err = unpopulate(val, "Image", &c.Image) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &c.Server) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ContainerResources. func (c ContainerResources) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2200,6 +3168,41 @@ func (c *CorsPolicy) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CustomContainerTemplate. +func (c CustomContainerTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "containers", c.Containers) + populate(objectMap, "ingress", c.Ingress) + populate(objectMap, "registryCredentials", c.RegistryCredentials) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomContainerTemplate. +func (c *CustomContainerTemplate) UnmarshalJSON(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 "containers": + err = unpopulate(val, "Containers", &c.Containers) + delete(rawMsg, key) + case "ingress": + err = unpopulate(val, "Ingress", &c.Ingress) + delete(rawMsg, key) + case "registryCredentials": + err = unpopulate(val, "RegistryCredentials", &c.RegistryCredentials) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CustomDomain. func (c CustomDomain) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2238,6 +3241,7 @@ func (c *CustomDomain) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CustomDomainConfiguration. func (c CustomDomainConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "certificateKeyVaultProperties", c.CertificateKeyVaultProperties) populate(objectMap, "certificatePassword", c.CertificatePassword) populateByteArray(objectMap, "certificateValue", c.CertificateValue, func() any { return runtime.EncodeByteArray(c.CertificateValue, runtime.Base64StdFormat) @@ -2259,6 +3263,9 @@ func (c *CustomDomainConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "certificateKeyVaultProperties": + err = unpopulate(val, "CertificateKeyVaultProperties", &c.CertificateKeyVaultProperties) + delete(rawMsg, key) case "certificatePassword": err = unpopulate(val, "CertificatePassword", &c.CertificatePassword) delete(rawMsg, key) @@ -2474,6 +3481,7 @@ func (c *CustomOpenIDConnectProvider) UnmarshalJSON(data []byte) error { func (c CustomScaleRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "auth", c.Auth) + populate(objectMap, "identity", c.Identity) populate(objectMap, "metadata", c.Metadata) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) @@ -2491,6 +3499,9 @@ func (c *CustomScaleRule) UnmarshalJSON(data []byte) error { case "auth": err = unpopulate(val, "Auth", &c.Auth) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) case "metadata": err = unpopulate(val, "Metadata", &c.Metadata) delete(rawMsg, key) @@ -2613,6 +3624,7 @@ func (d DaprComponentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "scopes", d.Scopes) populate(objectMap, "secretStoreComponent", d.SecretStoreComponent) populate(objectMap, "secrets", d.Secrets) + populate(objectMap, "serviceComponentBind", d.ServiceComponentBind) populate(objectMap, "version", d.Version) return json.Marshal(objectMap) } @@ -2647,6 +3659,9 @@ func (d *DaprComponentProperties) UnmarshalJSON(data []byte) error { case "secrets": err = unpopulate(val, "Secrets", &d.Secrets) delete(rawMsg, key) + case "serviceComponentBind": + err = unpopulate(val, "ServiceComponentBind", &d.ServiceComponentBind) + delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &d.Version) delete(rawMsg, key) @@ -2658,6 +3673,305 @@ func (d *DaprComponentProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DaprComponentResiliencyPoliciesCollection. +func (d DaprComponentResiliencyPoliciesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentResiliencyPoliciesCollection. +func (d *DaprComponentResiliencyPoliciesCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentResiliencyPolicy. +func (d DaprComponentResiliencyPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentResiliencyPolicy. +func (d *DaprComponentResiliencyPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration. +func (d DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "consecutiveErrors", d.ConsecutiveErrors) + populate(objectMap, "intervalInSeconds", d.IntervalInSeconds) + populate(objectMap, "timeoutInSeconds", d.TimeoutInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration. +func (d *DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consecutiveErrors": + err = unpopulate(val, "ConsecutiveErrors", &d.ConsecutiveErrors) + delete(rawMsg, key) + case "intervalInSeconds": + err = unpopulate(val, "IntervalInSeconds", &d.IntervalInSeconds) + delete(rawMsg, key) + case "timeoutInSeconds": + err = unpopulate(val, "TimeoutInSeconds", &d.TimeoutInSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentResiliencyPolicyConfiguration. +func (d DaprComponentResiliencyPolicyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "circuitBreakerPolicy", d.CircuitBreakerPolicy) + populate(objectMap, "httpRetryPolicy", d.HTTPRetryPolicy) + populate(objectMap, "timeoutPolicy", d.TimeoutPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentResiliencyPolicyConfiguration. +func (d *DaprComponentResiliencyPolicyConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "circuitBreakerPolicy": + err = unpopulate(val, "CircuitBreakerPolicy", &d.CircuitBreakerPolicy) + delete(rawMsg, key) + case "httpRetryPolicy": + err = unpopulate(val, "HTTPRetryPolicy", &d.HTTPRetryPolicy) + delete(rawMsg, key) + case "timeoutPolicy": + err = unpopulate(val, "TimeoutPolicy", &d.TimeoutPolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration. +func (d DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "initialDelayInMilliseconds", d.InitialDelayInMilliseconds) + populate(objectMap, "maxIntervalInMilliseconds", d.MaxIntervalInMilliseconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration. +func (d *DaprComponentResiliencyPolicyHTTPRetryBackOffConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "initialDelayInMilliseconds": + err = unpopulate(val, "InitialDelayInMilliseconds", &d.InitialDelayInMilliseconds) + delete(rawMsg, key) + case "maxIntervalInMilliseconds": + err = unpopulate(val, "MaxIntervalInMilliseconds", &d.MaxIntervalInMilliseconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration. +func (d DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxRetries", d.MaxRetries) + populate(objectMap, "retryBackOff", d.RetryBackOff) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration. +func (d *DaprComponentResiliencyPolicyHTTPRetryPolicyConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxRetries": + err = unpopulate(val, "MaxRetries", &d.MaxRetries) + delete(rawMsg, key) + case "retryBackOff": + err = unpopulate(val, "RetryBackOff", &d.RetryBackOff) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentResiliencyPolicyProperties. +func (d DaprComponentResiliencyPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "inboundPolicy", d.InboundPolicy) + populate(objectMap, "outboundPolicy", d.OutboundPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentResiliencyPolicyProperties. +func (d *DaprComponentResiliencyPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "inboundPolicy": + err = unpopulate(val, "InboundPolicy", &d.InboundPolicy) + delete(rawMsg, key) + case "outboundPolicy": + err = unpopulate(val, "OutboundPolicy", &d.OutboundPolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentResiliencyPolicyTimeoutPolicyConfiguration. +func (d DaprComponentResiliencyPolicyTimeoutPolicyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "responseTimeoutInSeconds", d.ResponseTimeoutInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentResiliencyPolicyTimeoutPolicyConfiguration. +func (d *DaprComponentResiliencyPolicyTimeoutPolicyConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "responseTimeoutInSeconds": + err = unpopulate(val, "ResponseTimeoutInSeconds", &d.ResponseTimeoutInSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprComponentServiceBinding. +func (d DaprComponentServiceBinding) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "name", d.Name) + populate(objectMap, "serviceId", d.ServiceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprComponentServiceBinding. +func (d *DaprComponentServiceBinding) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "serviceId": + err = unpopulate(val, "ServiceID", &d.ServiceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DaprComponentsCollection. func (d DaprComponentsCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2809,6 +4123,290 @@ func (d *DaprSecretsCollection) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DaprServiceBindMetadata. +func (d DaprServiceBindMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprServiceBindMetadata. +func (d *DaprServiceBindMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprSubscription. +func (d DaprSubscription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSubscription. +func (d *DaprSubscription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprSubscriptionBulkSubscribeOptions. +func (d DaprSubscriptionBulkSubscribeOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", d.Enabled) + populate(objectMap, "maxAwaitDurationMs", d.MaxAwaitDurationMs) + populate(objectMap, "maxMessagesCount", d.MaxMessagesCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSubscriptionBulkSubscribeOptions. +func (d *DaprSubscriptionBulkSubscribeOptions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + delete(rawMsg, key) + case "maxAwaitDurationMs": + err = unpopulate(val, "MaxAwaitDurationMs", &d.MaxAwaitDurationMs) + delete(rawMsg, key) + case "maxMessagesCount": + err = unpopulate(val, "MaxMessagesCount", &d.MaxMessagesCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprSubscriptionProperties. +func (d DaprSubscriptionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bulkSubscribe", d.BulkSubscribe) + populate(objectMap, "deadLetterTopic", d.DeadLetterTopic) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "pubsubName", d.PubsubName) + populate(objectMap, "routes", d.Routes) + populate(objectMap, "scopes", d.Scopes) + populate(objectMap, "topic", d.Topic) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSubscriptionProperties. +func (d *DaprSubscriptionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bulkSubscribe": + err = unpopulate(val, "BulkSubscribe", &d.BulkSubscribe) + delete(rawMsg, key) + case "deadLetterTopic": + err = unpopulate(val, "DeadLetterTopic", &d.DeadLetterTopic) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "pubsubName": + err = unpopulate(val, "PubsubName", &d.PubsubName) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &d.Routes) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &d.Scopes) + delete(rawMsg, key) + case "topic": + err = unpopulate(val, "Topic", &d.Topic) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprSubscriptionRouteRule. +func (d DaprSubscriptionRouteRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "match", d.Match) + populate(objectMap, "path", d.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSubscriptionRouteRule. +func (d *DaprSubscriptionRouteRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "match": + err = unpopulate(val, "Match", &d.Match) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &d.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprSubscriptionRoutes. +func (d DaprSubscriptionRoutes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "default", d.Default) + populate(objectMap, "rules", d.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSubscriptionRoutes. +func (d *DaprSubscriptionRoutes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "default": + err = unpopulate(val, "Default", &d.Default) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &d.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprSubscriptionsCollection. +func (d DaprSubscriptionsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprSubscriptionsCollection. +func (d *DaprSubscriptionsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataDogConfiguration. +func (d DataDogConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", d.Key) + populate(objectMap, "site", d.Site) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataDogConfiguration. +func (d *DataDogConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "key": + err = unpopulate(val, "Key", &d.Key) + delete(rawMsg, key) + case "site": + err = unpopulate(val, "Site", &d.Site) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DefaultAuthorizationPolicy. func (d DefaultAuthorizationPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2945,6 +4543,37 @@ func (d *DefaultErrorResponseErrorDetailsItem) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type DestinationsConfiguration. +func (d DestinationsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataDogConfiguration", d.DataDogConfiguration) + populate(objectMap, "otlpConfigurations", d.OtlpConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationsConfiguration. +func (d *DestinationsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDogConfiguration": + err = unpopulate(val, "DataDogConfiguration", &d.DataDogConfiguration) + delete(rawMsg, key) + case "otlpConfigurations": + err = unpopulate(val, "OtlpConfigurations", &d.OtlpConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DiagnosticDataProviderMetadata. func (d DiagnosticDataProviderMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3381,6 +5010,212 @@ func (d *DiagnosticsStatus) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DotNetComponent. +func (d DotNetComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DotNetComponent. +func (d *DotNetComponent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DotNetComponentConfigurationProperty. +func (d DotNetComponentConfigurationProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "propertyName", d.PropertyName) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DotNetComponentConfigurationProperty. +func (d *DotNetComponentConfigurationProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "propertyName": + err = unpopulate(val, "PropertyName", &d.PropertyName) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DotNetComponentProperties. +func (d DotNetComponentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "componentType", d.ComponentType) + populate(objectMap, "configurations", d.Configurations) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "serviceBinds", d.ServiceBinds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DotNetComponentProperties. +func (d *DotNetComponentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "componentType": + err = unpopulate(val, "ComponentType", &d.ComponentType) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &d.Configurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "serviceBinds": + err = unpopulate(val, "ServiceBinds", &d.ServiceBinds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DotNetComponentServiceBind. +func (d DotNetComponentServiceBind) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + populate(objectMap, "serviceId", d.ServiceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DotNetComponentServiceBind. +func (d *DotNetComponentServiceBind) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "serviceId": + err = unpopulate(val, "ServiceID", &d.ServiceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DotNetComponentsCollection. +func (d DotNetComponentsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DotNetComponentsCollection. +func (d *DotNetComponentsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DynamicPoolConfiguration. +func (d DynamicPoolConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cooldownPeriodInSeconds", d.CooldownPeriodInSeconds) + populate(objectMap, "executionType", d.ExecutionType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicPoolConfiguration. +func (d *DynamicPoolConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cooldownPeriodInSeconds": + err = unpopulate(val, "CooldownPeriodInSeconds", &d.CooldownPeriodInSeconds) + delete(rawMsg, key) + case "executionType": + err = unpopulate(val, "ExecutionType", &d.ExecutionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type EncryptionSettings. func (e EncryptionSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3529,6 +5364,37 @@ func (e *EnvironmentVar) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EnvironmentVariable. +func (e EnvironmentVariable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentVariable. +func (e *EnvironmentVariable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3603,6 +5469,61 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorEntity. +func (e ErrorEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "extendedCode", e.ExtendedCode) + populate(objectMap, "innerErrors", e.InnerErrors) + populate(objectMap, "message", e.Message) + populate(objectMap, "messageTemplate", e.MessageTemplate) + populate(objectMap, "parameters", e.Parameters) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorEntity. +func (e *ErrorEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "extendedCode": + err = unpopulate(val, "ExtendedCode", &e.ExtendedCode) + delete(rawMsg, key) + case "innerErrors": + err = unpopulate(val, "InnerErrors", &e.InnerErrors) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "messageTemplate": + err = unpopulate(val, "MessageTemplate", &e.MessageTemplate) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &e.Parameters) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3630,6 +5551,33 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ExecutionStatus. +func (e ExecutionStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "replicas", e.Replicas) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecutionStatus. +func (e *ExecutionStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "replicas": + err = unpopulate(val, "Replicas", &e.Replicas) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. func (e ExtendedLocation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3774,7 +5722,9 @@ func (g *GitHub) UnmarshalJSON(data []byte) error { func (g GithubActionConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "azureCredentials", g.AzureCredentials) + populate(objectMap, "buildEnvironmentVariables", g.BuildEnvironmentVariables) populate(objectMap, "contextPath", g.ContextPath) + populate(objectMap, "dockerfilePath", g.DockerfilePath) populate(objectMap, "githubPersonalAccessToken", g.GithubPersonalAccessToken) populate(objectMap, "image", g.Image) populate(objectMap, "os", g.OS) @@ -3797,9 +5747,15 @@ func (g *GithubActionConfiguration) UnmarshalJSON(data []byte) error { case "azureCredentials": err = unpopulate(val, "AzureCredentials", &g.AzureCredentials) delete(rawMsg, key) + case "buildEnvironmentVariables": + err = unpopulate(val, "BuildEnvironmentVariables", &g.BuildEnvironmentVariables) + delete(rawMsg, key) case "contextPath": err = unpopulate(val, "ContextPath", &g.ContextPath) delete(rawMsg, key) + case "dockerfilePath": + err = unpopulate(val, "DockerfilePath", &g.DockerfilePath) + delete(rawMsg, key) case "githubPersonalAccessToken": err = unpopulate(val, "GithubPersonalAccessToken", &g.GithubPersonalAccessToken) delete(rawMsg, key) @@ -3903,10 +5859,178 @@ func (g *Google) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type HTTPConnectionPool. +func (h HTTPConnectionPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "http1MaxPendingRequests", h.HTTP1MaxPendingRequests) + populate(objectMap, "http2MaxRequests", h.HTTP2MaxRequests) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPConnectionPool. +func (h *HTTPConnectionPool) UnmarshalJSON(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 "http1MaxPendingRequests": + err = unpopulate(val, "HTTP1MaxPendingRequests", &h.HTTP1MaxPendingRequests) + delete(rawMsg, key) + case "http2MaxRequests": + err = unpopulate(val, "HTTP2MaxRequests", &h.HTTP2MaxRequests) + 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 HTTPGet. +func (h HTTPGet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fileName", h.FileName) + populate(objectMap, "headers", h.Headers) + populate(objectMap, "url", h.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPGet. +func (h *HTTPGet) UnmarshalJSON(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 "fileName": + err = unpopulate(val, "FileName", &h.FileName) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &h.Headers) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &h.URL) + 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 HTTPRetryPolicy. +func (h HTTPRetryPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "matches", h.Matches) + populate(objectMap, "maxRetries", h.MaxRetries) + populate(objectMap, "retryBackOff", h.RetryBackOff) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRetryPolicy. +func (h *HTTPRetryPolicy) UnmarshalJSON(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 "matches": + err = unpopulate(val, "Matches", &h.Matches) + delete(rawMsg, key) + case "maxRetries": + err = unpopulate(val, "MaxRetries", &h.MaxRetries) + delete(rawMsg, key) + case "retryBackOff": + err = unpopulate(val, "RetryBackOff", &h.RetryBackOff) + 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 HTTPRetryPolicyMatches. +func (h HTTPRetryPolicyMatches) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errors", h.Errors) + populate(objectMap, "httpStatusCodes", h.HTTPStatusCodes) + populate(objectMap, "headers", h.Headers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRetryPolicyMatches. +func (h *HTTPRetryPolicyMatches) UnmarshalJSON(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 "errors": + err = unpopulate(val, "Errors", &h.Errors) + delete(rawMsg, key) + case "httpStatusCodes": + err = unpopulate(val, "HTTPStatusCodes", &h.HTTPStatusCodes) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &h.Headers) + 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 HTTPRetryPolicyRetryBackOff. +func (h HTTPRetryPolicyRetryBackOff) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "initialDelayInMilliseconds", h.InitialDelayInMilliseconds) + populate(objectMap, "maxIntervalInMilliseconds", h.MaxIntervalInMilliseconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRetryPolicyRetryBackOff. +func (h *HTTPRetryPolicyRetryBackOff) UnmarshalJSON(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 "initialDelayInMilliseconds": + err = unpopulate(val, "InitialDelayInMilliseconds", &h.InitialDelayInMilliseconds) + delete(rawMsg, key) + case "maxIntervalInMilliseconds": + err = unpopulate(val, "MaxIntervalInMilliseconds", &h.MaxIntervalInMilliseconds) + 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) } @@ -3923,6 +6047,9 @@ func (h *HTTPScaleRule) UnmarshalJSON(data []byte) error { 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) @@ -3996,6 +6123,107 @@ func (h *HTTPSettingsRoutes) UnmarshalJSON(data []byte) error { 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) @@ -4090,6 +6318,37 @@ func (i *IdentityProviders) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type IdentitySettings. +func (i IdentitySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", i.Identity) + populate(objectMap, "lifecycle", i.Lifecycle) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentitySettings. +func (i *IdentitySettings) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &i.Identity) + delete(rawMsg, key) + case "lifecycle": + err = unpopulate(val, "Lifecycle", &i.Lifecycle) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Ingress. func (i Ingress) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4104,6 +6363,7 @@ func (i Ingress) MarshalJSON() ([]byte, error) { populate(objectMap, "ipSecurityRestrictions", i.IPSecurityRestrictions) populate(objectMap, "stickySessions", i.StickySessions) populate(objectMap, "targetPort", i.TargetPort) + populate(objectMap, "targetPortHttpScheme", i.TargetPortHTTPScheme) populate(objectMap, "traffic", i.Traffic) populate(objectMap, "transport", i.Transport) return json.Marshal(objectMap) @@ -4151,6 +6411,9 @@ func (i *Ingress) UnmarshalJSON(data []byte) error { case "targetPort": err = unpopulate(val, "TargetPort", &i.TargetPort) delete(rawMsg, key) + case "targetPortHttpScheme": + err = unpopulate(val, "TargetPortHTTPScheme", &i.TargetPortHTTPScheme) + delete(rawMsg, key) case "traffic": err = unpopulate(val, "Traffic", &i.Traffic) delete(rawMsg, key) @@ -4234,6 +6497,7 @@ func (i InitContainer) MarshalJSON() ([]byte, error) { populate(objectMap, "command", i.Command) populate(objectMap, "env", i.Env) populate(objectMap, "image", i.Image) + populate(objectMap, "imageType", i.ImageType) populate(objectMap, "name", i.Name) populate(objectMap, "resources", i.Resources) populate(objectMap, "volumeMounts", i.VolumeMounts) @@ -4261,6 +6525,9 @@ func (i *InitContainer) UnmarshalJSON(data []byte) error { case "image": err = unpopulate(val, "Image", &i.Image) delete(rawMsg, key) + case "imageType": + err = unpopulate(val, "ImageType", &i.ImageType) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) @@ -4278,9 +6545,247 @@ func (i *InitContainer) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type JavaComponent. +func (j JavaComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", j.ID) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaComponent. +func (j *JavaComponent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "properties": + j.Properties, err = unmarshalJavaComponentPropertiesClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &j.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JavaComponentConfigurationProperty. +func (j JavaComponentConfigurationProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "propertyName", j.PropertyName) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaComponentConfigurationProperty. +func (j *JavaComponentConfigurationProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "propertyName": + err = unpopulate(val, "PropertyName", &j.PropertyName) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JavaComponentIngress. +func (j JavaComponentIngress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fqdn", j.Fqdn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaComponentIngress. +func (j *JavaComponentIngress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdn": + err = unpopulate(val, "Fqdn", &j.Fqdn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JavaComponentProperties. +func (j JavaComponentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["componentType"] = j.ComponentType + populate(objectMap, "configurations", j.Configurations) + populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "scale", j.Scale) + populate(objectMap, "serviceBinds", j.ServiceBinds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaComponentProperties. +func (j *JavaComponentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "componentType": + err = unpopulate(val, "ComponentType", &j.ComponentType) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &j.Configurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) + delete(rawMsg, key) + case "scale": + err = unpopulate(val, "Scale", &j.Scale) + delete(rawMsg, key) + case "serviceBinds": + err = unpopulate(val, "ServiceBinds", &j.ServiceBinds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JavaComponentPropertiesScale. +func (j JavaComponentPropertiesScale) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxReplicas", j.MaxReplicas) + populate(objectMap, "minReplicas", j.MinReplicas) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaComponentPropertiesScale. +func (j *JavaComponentPropertiesScale) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxReplicas": + err = unpopulate(val, "MaxReplicas", &j.MaxReplicas) + delete(rawMsg, key) + case "minReplicas": + err = unpopulate(val, "MinReplicas", &j.MinReplicas) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JavaComponentServiceBind. +func (j JavaComponentServiceBind) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", j.Name) + populate(objectMap, "serviceId", j.ServiceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaComponentServiceBind. +func (j *JavaComponentServiceBind) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "serviceId": + err = unpopulate(val, "ServiceID", &j.ServiceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JavaComponentsCollection. +func (j JavaComponentsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaComponentsCollection. +func (j *JavaComponentsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Job. func (j Job) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", j.ExtendedLocation) populate(objectMap, "id", j.ID) populate(objectMap, "identity", j.Identity) populate(objectMap, "location", j.Location) @@ -4301,6 +6806,9 @@ func (j *Job) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &j.ExtendedLocation) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &j.ID) delete(rawMsg, key) @@ -4337,6 +6845,7 @@ func (j *Job) UnmarshalJSON(data []byte) error { func (j JobConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "eventTriggerConfig", j.EventTriggerConfig) + populate(objectMap, "identitySettings", j.IdentitySettings) populate(objectMap, "manualTriggerConfig", j.ManualTriggerConfig) populate(objectMap, "registries", j.Registries) populate(objectMap, "replicaRetryLimit", j.ReplicaRetryLimit) @@ -4359,6 +6868,9 @@ func (j *JobConfiguration) UnmarshalJSON(data []byte) error { case "eventTriggerConfig": err = unpopulate(val, "EventTriggerConfig", &j.EventTriggerConfig) delete(rawMsg, key) + case "identitySettings": + err = unpopulate(val, "IdentitySettings", &j.IdentitySettings) + delete(rawMsg, key) case "manualTriggerConfig": err = unpopulate(val, "ManualTriggerConfig", &j.ManualTriggerConfig) delete(rawMsg, key) @@ -4636,6 +7148,7 @@ func (j *JobExecutionNamesCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobExecutionProperties. func (j JobExecutionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "detailedStatus", j.DetailedStatus) populateDateTimeRFC3339(objectMap, "endTime", j.EndTime) populateDateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "status", j.Status) @@ -4652,6 +7165,9 @@ func (j *JobExecutionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "detailedStatus": + err = unpopulate(val, "DetailedStatus", &j.DetailedStatus) + delete(rawMsg, key) case "endTime": err = unpopulateDateTimeRFC3339(val, "EndTime", &j.EndTime) delete(rawMsg, key) @@ -4706,6 +7222,7 @@ func (j *JobExecutionTemplate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobPatchProperties. func (j JobPatchProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", j.ExtendedLocation) populate(objectMap, "identity", j.Identity) populate(objectMap, "properties", j.Properties) populate(objectMap, "tags", j.Tags) @@ -4721,6 +7238,9 @@ func (j *JobPatchProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &j.ExtendedLocation) + delete(rawMsg, key) case "identity": err = unpopulate(val, "Identity", &j.Identity) delete(rawMsg, key) @@ -4789,6 +7309,7 @@ func (j JobProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "eventStreamEndpoint", j.EventStreamEndpoint) populate(objectMap, "outboundIpAddresses", j.OutboundIPAddresses) populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "runningState", j.RunningState) populate(objectMap, "template", j.Template) populate(objectMap, "workloadProfileName", j.WorkloadProfileName) return json.Marshal(objectMap) @@ -4818,6 +7339,9 @@ func (j *JobProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) delete(rawMsg, key) + case "runningState": + err = unpopulate(val, "RunningState", &j.RunningState) + delete(rawMsg, key) case "template": err = unpopulate(val, "Template", &j.Template) delete(rawMsg, key) @@ -4875,6 +7399,7 @@ func (j *JobScale) UnmarshalJSON(data []byte) error { func (j JobScaleRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "auth", j.Auth) + populate(objectMap, "identity", j.Identity) populateAny(objectMap, "metadata", j.Metadata) populate(objectMap, "name", j.Name) populate(objectMap, "type", j.Type) @@ -4893,6 +7418,9 @@ func (j *JobScaleRule) UnmarshalJSON(data []byte) error { case "auth": err = unpopulate(val, "Auth", &j.Auth) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &j.Identity) + delete(rawMsg, key) case "metadata": err = unpopulate(val, "Metadata", &j.Metadata) delete(rawMsg, key) @@ -5096,6 +7624,7 @@ func (l *ListUsagesResult) UnmarshalJSON(data []byte) error { func (l LogAnalyticsConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "customerId", l.CustomerID) + populate(objectMap, "dynamicJsonColumns", l.DynamicJSONColumns) populate(objectMap, "sharedKey", l.SharedKey) return json.Marshal(objectMap) } @@ -5112,6 +7641,9 @@ func (l *LogAnalyticsConfiguration) UnmarshalJSON(data []byte) error { case "customerId": err = unpopulate(val, "CustomerID", &l.CustomerID) delete(rawMsg, key) + case "dynamicJsonColumns": + err = unpopulate(val, "DynamicJSONColumns", &l.DynamicJSONColumns) + delete(rawMsg, key) case "sharedKey": err = unpopulate(val, "SharedKey", &l.SharedKey) delete(rawMsg, key) @@ -5123,6 +7655,80 @@ func (l *LogAnalyticsConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LoggerSetting. +func (l LoggerSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "level", l.Level) + populate(objectMap, "logger", l.Logger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoggerSetting. +func (l *LoggerSetting) UnmarshalJSON(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 "level": + err = unpopulate(val, "Level", &l.Level) + delete(rawMsg, key) + case "logger": + err = unpopulate(val, "Logger", &l.Logger) + 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 LogicApp. +func (l LogicApp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populateAny(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 LogicApp. +func (l *LogicApp) UnmarshalJSON(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 Login. func (l Login) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5224,6 +7830,33 @@ func (l *LoginScopes) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LogsConfiguration. +func (l LogsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinations", l.Destinations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogsConfiguration. +func (l *LogsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinations": + err = unpopulate(val, "Destinations", &l.Destinations) + 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 ManagedCertificate. func (m ManagedCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5380,6 +8013,7 @@ func (m *ManagedCertificateProperties) UnmarshalJSON(data []byte) error { func (m ManagedEnvironment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "kind", m.Kind) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) @@ -5402,6 +8036,9 @@ func (m *ManagedEnvironment) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &m.Kind) delete(rawMsg, key) @@ -5434,6 +8071,7 @@ func (m *ManagedEnvironment) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManagedEnvironmentProperties. func (m ManagedEnvironmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "appInsightsConfiguration", m.AppInsightsConfiguration) populate(objectMap, "appLogsConfiguration", m.AppLogsConfiguration) populate(objectMap, "customDomainConfiguration", m.CustomDomainConfiguration) populate(objectMap, "daprAIConnectionString", m.DaprAIConnectionString) @@ -5444,9 +8082,12 @@ func (m ManagedEnvironmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "eventStreamEndpoint", m.EventStreamEndpoint) populate(objectMap, "infrastructureResourceGroup", m.InfrastructureResourceGroup) populate(objectMap, "kedaConfiguration", m.KedaConfiguration) + populate(objectMap, "openTelemetryConfiguration", m.OpenTelemetryConfiguration) populate(objectMap, "peerAuthentication", m.PeerAuthentication) populate(objectMap, "peerTrafficConfiguration", m.PeerTrafficConfiguration) + populate(objectMap, "privateEndpointConnections", m.PrivateEndpointConnections) populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) populate(objectMap, "staticIp", m.StaticIP) populate(objectMap, "vnetConfiguration", m.VnetConfiguration) populate(objectMap, "workloadProfiles", m.WorkloadProfiles) @@ -5463,6 +8104,9 @@ func (m *ManagedEnvironmentProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "appInsightsConfiguration": + err = unpopulate(val, "AppInsightsConfiguration", &m.AppInsightsConfiguration) + delete(rawMsg, key) case "appLogsConfiguration": err = unpopulate(val, "AppLogsConfiguration", &m.AppLogsConfiguration) delete(rawMsg, key) @@ -5493,15 +8137,24 @@ func (m *ManagedEnvironmentProperties) UnmarshalJSON(data []byte) error { case "kedaConfiguration": err = unpopulate(val, "KedaConfiguration", &m.KedaConfiguration) delete(rawMsg, key) + case "openTelemetryConfiguration": + err = unpopulate(val, "OpenTelemetryConfiguration", &m.OpenTelemetryConfiguration) + delete(rawMsg, key) case "peerAuthentication": err = unpopulate(val, "PeerAuthentication", &m.PeerAuthentication) delete(rawMsg, key) case "peerTrafficConfiguration": err = unpopulate(val, "PeerTrafficConfiguration", &m.PeerTrafficConfiguration) delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &m.PrivateEndpointConnections) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &m.PublicNetworkAccess) + delete(rawMsg, key) case "staticIp": err = unpopulate(val, "StaticIP", &m.StaticIP) delete(rawMsg, key) @@ -5650,6 +8303,7 @@ func (m *ManagedEnvironmentStorage) UnmarshalJSON(data []byte) error { func (m ManagedEnvironmentStorageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "azureFile", m.AzureFile) + populate(objectMap, "nfsAzureFile", m.NfsAzureFile) return json.Marshal(objectMap) } @@ -5665,6 +8319,9 @@ func (m *ManagedEnvironmentStorageProperties) UnmarshalJSON(data []byte) error { case "azureFile": err = unpopulate(val, "AzureFile", &m.AzureFile) delete(rawMsg, key) + case "nfsAzureFile": + err = unpopulate(val, "NfsAzureFile", &m.NfsAzureFile) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -5770,6 +8427,37 @@ func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MetricsConfiguration. +func (m MetricsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinations", m.Destinations) + populate(objectMap, "includeKeda", m.IncludeKeda) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricsConfiguration. +func (m *MetricsConfiguration) UnmarshalJSON(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 "destinations": + err = unpopulate(val, "Destinations", &m.Destinations) + delete(rawMsg, key) + case "includeKeda": + err = unpopulate(val, "IncludeKeda", &m.IncludeKeda) + 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 Mtls. func (m Mtls) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5797,6 +8485,88 @@ func (m *Mtls) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NacosComponent. +func (n NacosComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["componentType"] = JavaComponentTypeNacos + populate(objectMap, "configurations", n.Configurations) + populate(objectMap, "ingress", n.Ingress) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "scale", n.Scale) + populate(objectMap, "serviceBinds", n.ServiceBinds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NacosComponent. +func (n *NacosComponent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "componentType": + err = unpopulate(val, "ComponentType", &n.ComponentType) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &n.Configurations) + delete(rawMsg, key) + case "ingress": + err = unpopulate(val, "Ingress", &n.Ingress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "scale": + err = unpopulate(val, "Scale", &n.Scale) + delete(rawMsg, key) + case "serviceBinds": + err = unpopulate(val, "ServiceBinds", &n.ServiceBinds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NfsAzureFileProperties. +func (n NfsAzureFileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessMode", n.AccessMode) + populate(objectMap, "server", n.Server) + populate(objectMap, "shareName", n.ShareName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NfsAzureFileProperties. +func (n *NfsAzureFileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessMode": + err = unpopulate(val, "AccessMode", &n.AccessMode) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &n.Server) + delete(rawMsg, key) + case "shareName": + err = unpopulate(val, "ShareName", &n.ShareName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Nonce. func (n Nonce) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5968,6 +8738,45 @@ func (o *OpenIDConnectRegistration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OpenTelemetryConfiguration. +func (o OpenTelemetryConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationsConfiguration", o.DestinationsConfiguration) + populate(objectMap, "logsConfiguration", o.LogsConfiguration) + populate(objectMap, "metricsConfiguration", o.MetricsConfiguration) + populate(objectMap, "tracesConfiguration", o.TracesConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OpenTelemetryConfiguration. +func (o *OpenTelemetryConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationsConfiguration": + err = unpopulate(val, "DestinationsConfiguration", &o.DestinationsConfiguration) + delete(rawMsg, key) + case "logsConfiguration": + err = unpopulate(val, "LogsConfiguration", &o.LogsConfiguration) + delete(rawMsg, key) + case "metricsConfiguration": + err = unpopulate(val, "MetricsConfiguration", &o.MetricsConfiguration) + delete(rawMsg, key) + case "tracesConfiguration": + err = unpopulate(val, "TracesConfiguration", &o.TracesConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OperationDetail. func (o OperationDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6046,6 +8855,598 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OtlpConfiguration. +func (o OtlpConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpoint", o.Endpoint) + populate(objectMap, "headers", o.Headers) + populate(objectMap, "insecure", o.Insecure) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OtlpConfiguration. +func (o *OtlpConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &o.Endpoint) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &o.Headers) + delete(rawMsg, key) + case "insecure": + err = unpopulate(val, "Insecure", &o.Insecure) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchCollection. +func (p PatchCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchCollection. +func (p *PatchCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchDetails. +func (p PatchDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "detectionStatus", p.DetectionStatus) + populateDateTimeRFC3339(objectMap, "lastDetectionTime", p.LastDetectionTime) + populate(objectMap, "newImageName", p.NewImageName) + populate(objectMap, "newLayer", p.NewLayer) + populate(objectMap, "oldLayer", p.OldLayer) + populate(objectMap, "patchType", p.PatchType) + populate(objectMap, "targetContainerName", p.TargetContainerName) + populate(objectMap, "targetImage", p.TargetImage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchDetails. +func (p *PatchDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "detectionStatus": + err = unpopulate(val, "DetectionStatus", &p.DetectionStatus) + delete(rawMsg, key) + case "lastDetectionTime": + err = unpopulateDateTimeRFC3339(val, "LastDetectionTime", &p.LastDetectionTime) + delete(rawMsg, key) + case "newImageName": + err = unpopulate(val, "NewImageName", &p.NewImageName) + delete(rawMsg, key) + case "newLayer": + err = unpopulate(val, "NewLayer", &p.NewLayer) + delete(rawMsg, key) + case "oldLayer": + err = unpopulate(val, "OldLayer", &p.OldLayer) + delete(rawMsg, key) + case "patchType": + err = unpopulate(val, "PatchType", &p.PatchType) + delete(rawMsg, key) + case "targetContainerName": + err = unpopulate(val, "TargetContainerName", &p.TargetContainerName) + delete(rawMsg, key) + case "targetImage": + err = unpopulate(val, "TargetImage", &p.TargetImage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchDetailsNewLayer. +func (p PatchDetailsNewLayer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "frameworkAndVersion", p.FrameworkAndVersion) + populate(objectMap, "name", p.Name) + populate(objectMap, "osAndVersion", p.OSAndVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchDetailsNewLayer. +func (p *PatchDetailsNewLayer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "frameworkAndVersion": + err = unpopulate(val, "FrameworkAndVersion", &p.FrameworkAndVersion) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "osAndVersion": + err = unpopulate(val, "OSAndVersion", &p.OSAndVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchDetailsOldLayer. +func (p PatchDetailsOldLayer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "frameworkAndVersion", p.FrameworkAndVersion) + populate(objectMap, "name", p.Name) + populate(objectMap, "osAndVersion", p.OSAndVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchDetailsOldLayer. +func (p *PatchDetailsOldLayer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "frameworkAndVersion": + err = unpopulate(val, "FrameworkAndVersion", &p.FrameworkAndVersion) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "osAndVersion": + err = unpopulate(val, "OSAndVersion", &p.OSAndVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchProperties. +func (p PatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", p.LastModifiedAt) + populate(objectMap, "patchApplyStatus", p.PatchApplyStatus) + populate(objectMap, "patchDetails", p.PatchDetails) + populate(objectMap, "targetContainerAppId", p.TargetContainerAppID) + populate(objectMap, "targetEnvironmentId", p.TargetEnvironmentID) + populate(objectMap, "targetRevisionId", p.TargetRevisionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchProperties. +func (p *PatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &p.LastModifiedAt) + delete(rawMsg, key) + case "patchApplyStatus": + err = unpopulate(val, "PatchApplyStatus", &p.PatchApplyStatus) + delete(rawMsg, key) + case "patchDetails": + err = unpopulate(val, "PatchDetails", &p.PatchDetails) + delete(rawMsg, key) + case "targetContainerAppId": + err = unpopulate(val, "TargetContainerAppID", &p.TargetContainerAppID) + delete(rawMsg, key) + case "targetEnvironmentId": + err = unpopulate(val, "TargetEnvironmentID", &p.TargetEnvironmentID) + delete(rawMsg, key) + case "targetRevisionId": + err = unpopulate(val, "TargetRevisionID", &p.TargetRevisionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchSkipConfig. +func (p PatchSkipConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "skip", p.Skip) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchSkipConfig. +func (p *PatchSkipConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "skip": + err = unpopulate(val, "Skip", &p.Skip) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PreBuildStep. +func (p PreBuildStep) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", p.Description) + populate(objectMap, "httpGet", p.HTTPGet) + populate(objectMap, "scripts", p.Scripts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PreBuildStep. +func (p *PreBuildStep) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "httpGet": + err = unpopulate(val, "HTTPGet", &p.HTTPGet) + delete(rawMsg, key) + case "scripts": + err = unpopulate(val, "Scripts", &p.Scripts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6088,7 +9489,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type QueueScaleRule. func (q QueueScaleRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "accountName", q.AccountName) populate(objectMap, "auth", q.Auth) + populate(objectMap, "identity", q.Identity) populate(objectMap, "queueLength", q.QueueLength) populate(objectMap, "queueName", q.QueueName) return json.Marshal(objectMap) @@ -6103,9 +9506,15 @@ func (q *QueueScaleRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "accountName": + err = unpopulate(val, "AccountName", &q.AccountName) + delete(rawMsg, key) case "auth": err = unpopulate(val, "Auth", &q.Auth) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &q.Identity) + delete(rawMsg, key) case "queueLength": err = unpopulate(val, "QueueLength", &q.QueueLength) delete(rawMsg, key) @@ -6268,6 +9677,7 @@ func (r *ReplicaCollection) UnmarshalJSON(data []byte) error { func (r ReplicaContainer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "containerId", r.ContainerID) + populate(objectMap, "debugEndpoint", r.DebugEndpoint) populate(objectMap, "execEndpoint", r.ExecEndpoint) populate(objectMap, "logStreamEndpoint", r.LogStreamEndpoint) populate(objectMap, "name", r.Name) @@ -6291,6 +9701,9 @@ func (r *ReplicaContainer) UnmarshalJSON(data []byte) error { case "containerId": err = unpopulate(val, "ContainerID", &r.ContainerID) delete(rawMsg, key) + case "debugEndpoint": + err = unpopulate(val, "DebugEndpoint", &r.DebugEndpoint) + delete(rawMsg, key) case "execEndpoint": err = unpopulate(val, "ExecEndpoint", &r.ExecEndpoint) delete(rawMsg, key) @@ -6323,6 +9736,37 @@ func (r *ReplicaContainer) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ReplicaExecutionStatus. +func (r ReplicaExecutionStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "containers", r.Containers) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaExecutionStatus. +func (r *ReplicaExecutionStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "containers": + err = unpopulate(val, "Containers", &r.Containers) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ReplicaProperties. func (r ReplicaProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6546,11 +9990,160 @@ func (r *RevisionProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Runtime. +func (r Runtime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dotnet", r.Dotnet) + populate(objectMap, "java", r.Java) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Runtime. +func (r *Runtime) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dotnet": + err = unpopulate(val, "Dotnet", &r.Dotnet) + delete(rawMsg, key) + case "java": + err = unpopulate(val, "Java", &r.Java) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuntimeDotnet. +func (r RuntimeDotnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoConfigureDataProtection", r.AutoConfigureDataProtection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuntimeDotnet. +func (r *RuntimeDotnet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoConfigureDataProtection": + err = unpopulate(val, "AutoConfigureDataProtection", &r.AutoConfigureDataProtection) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuntimeJava. +func (r RuntimeJava) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableMetrics", r.EnableMetrics) + populate(objectMap, "javaAgent", r.JavaAgent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuntimeJava. +func (r *RuntimeJava) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enableMetrics": + err = unpopulate(val, "EnableMetrics", &r.EnableMetrics) + delete(rawMsg, key) + case "javaAgent": + err = unpopulate(val, "JavaAgent", &r.JavaAgent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuntimeJavaAgent. +func (r RuntimeJavaAgent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", r.Enabled) + populate(objectMap, "logging", r.Logging) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuntimeJavaAgent. +func (r *RuntimeJavaAgent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &r.Enabled) + delete(rawMsg, key) + case "logging": + err = unpopulate(val, "Logging", &r.Logging) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuntimeJavaAgentLogging. +func (r RuntimeJavaAgentLogging) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "loggerSettings", r.LoggerSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuntimeJavaAgentLogging. +func (r *RuntimeJavaAgentLogging) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "loggerSettings": + err = unpopulate(val, "LoggerSettings", &r.LoggerSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Scale. func (s Scale) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "cooldownPeriod", s.CooldownPeriod) populate(objectMap, "maxReplicas", s.MaxReplicas) populate(objectMap, "minReplicas", s.MinReplicas) + populate(objectMap, "pollingInterval", s.PollingInterval) populate(objectMap, "rules", s.Rules) return json.Marshal(objectMap) } @@ -6564,12 +10157,18 @@ func (s *Scale) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "cooldownPeriod": + err = unpopulate(val, "CooldownPeriod", &s.CooldownPeriod) + delete(rawMsg, key) case "maxReplicas": err = unpopulate(val, "MaxReplicas", &s.MaxReplicas) delete(rawMsg, key) case "minReplicas": err = unpopulate(val, "MinReplicas", &s.MinReplicas) delete(rawMsg, key) + case "pollingInterval": + err = unpopulate(val, "PollingInterval", &s.PollingInterval) + delete(rawMsg, key) case "rules": err = unpopulate(val, "Rules", &s.Rules) delete(rawMsg, key) @@ -6581,6 +10180,37 @@ func (s *Scale) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ScaleConfiguration. +func (s ScaleConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxConcurrentSessions", s.MaxConcurrentSessions) + populate(objectMap, "readySessionInstances", s.ReadySessionInstances) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleConfiguration. +func (s *ScaleConfiguration) UnmarshalJSON(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 "maxConcurrentSessions": + err = unpopulate(val, "MaxConcurrentSessions", &s.MaxConcurrentSessions) + delete(rawMsg, key) + case "readySessionInstances": + err = unpopulate(val, "ReadySessionInstances", &s.ReadySessionInstances) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ScaleRule. func (s ScaleRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6655,6 +10285,49 @@ func (s *ScaleRuleAuth) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ScgRoute. +func (s ScgRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "filters", s.Filters) + populate(objectMap, "id", s.ID) + populate(objectMap, "order", s.Order) + populate(objectMap, "predicates", s.Predicates) + populate(objectMap, "uri", s.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScgRoute. +func (s *ScgRoute) UnmarshalJSON(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 "filters": + err = unpopulate(val, "Filters", &s.Filters) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &s.Order) + delete(rawMsg, key) + case "predicates": + err = unpopulate(val, "Predicates", &s.Predicates) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &s.URI) + 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) @@ -6782,6 +10455,8 @@ func (s *Service) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServiceBind. func (s ServiceBind) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "clientType", s.ClientType) + populate(objectMap, "customizedKeys", s.CustomizedKeys) populate(objectMap, "name", s.Name) populate(objectMap, "serviceId", s.ServiceID) return json.Marshal(objectMap) @@ -6796,6 +10471,12 @@ func (s *ServiceBind) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "clientType": + err = unpopulate(val, "ClientType", &s.ClientType) + delete(rawMsg, key) + case "customizedKeys": + err = unpopulate(val, "CustomizedKeys", &s.CustomizedKeys) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) @@ -6810,6 +10491,474 @@ func (s *ServiceBind) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SessionContainer. +func (s SessionContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "args", s.Args) + populate(objectMap, "command", s.Command) + populate(objectMap, "env", s.Env) + populate(objectMap, "image", s.Image) + populate(objectMap, "name", s.Name) + populate(objectMap, "resources", s.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionContainer. +func (s *SessionContainer) UnmarshalJSON(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 "args": + err = unpopulate(val, "Args", &s.Args) + delete(rawMsg, key) + case "command": + err = unpopulate(val, "Command", &s.Command) + delete(rawMsg, key) + case "env": + err = unpopulate(val, "Env", &s.Env) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &s.Image) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &s.Resources) + 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 SessionContainerResources. +func (s SessionContainerResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cpu", s.CPU) + populate(objectMap, "memory", s.Memory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionContainerResources. +func (s *SessionContainerResources) UnmarshalJSON(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 "cpu": + err = unpopulate(val, "CPU", &s.CPU) + delete(rawMsg, key) + case "memory": + err = unpopulate(val, "Memory", &s.Memory) + 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 SessionIngress. +func (s SessionIngress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "targetPort", s.TargetPort) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionIngress. +func (s *SessionIngress) UnmarshalJSON(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 "targetPort": + err = unpopulate(val, "TargetPort", &s.TargetPort) + 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 SessionNetworkConfiguration. +func (s SessionNetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionNetworkConfiguration. +func (s *SessionNetworkConfiguration) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &s.Status) + 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 SessionPool. +func (s SessionPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionPool. +func (s *SessionPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SessionPoolCollection. +func (s SessionPoolCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionPoolCollection. +func (s *SessionPoolCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SessionPoolProperties. +func (s SessionPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "containerType", s.ContainerType) + populate(objectMap, "customContainerTemplate", s.CustomContainerTemplate) + populate(objectMap, "dynamicPoolConfiguration", s.DynamicPoolConfiguration) + populate(objectMap, "environmentId", s.EnvironmentID) + populate(objectMap, "nodeCount", s.NodeCount) + populate(objectMap, "poolManagementEndpoint", s.PoolManagementEndpoint) + populate(objectMap, "poolManagementType", s.PoolManagementType) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "scaleConfiguration", s.ScaleConfiguration) + populate(objectMap, "secrets", s.Secrets) + populate(objectMap, "sessionNetworkConfiguration", s.SessionNetworkConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionPoolProperties. +func (s *SessionPoolProperties) UnmarshalJSON(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 "containerType": + err = unpopulate(val, "ContainerType", &s.ContainerType) + delete(rawMsg, key) + case "customContainerTemplate": + err = unpopulate(val, "CustomContainerTemplate", &s.CustomContainerTemplate) + delete(rawMsg, key) + case "dynamicPoolConfiguration": + err = unpopulate(val, "DynamicPoolConfiguration", &s.DynamicPoolConfiguration) + delete(rawMsg, key) + case "environmentId": + err = unpopulate(val, "EnvironmentID", &s.EnvironmentID) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &s.NodeCount) + delete(rawMsg, key) + case "poolManagementEndpoint": + err = unpopulate(val, "PoolManagementEndpoint", &s.PoolManagementEndpoint) + delete(rawMsg, key) + case "poolManagementType": + err = unpopulate(val, "PoolManagementType", &s.PoolManagementType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "scaleConfiguration": + err = unpopulate(val, "ScaleConfiguration", &s.ScaleConfiguration) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &s.Secrets) + delete(rawMsg, key) + case "sessionNetworkConfiguration": + err = unpopulate(val, "SessionNetworkConfiguration", &s.SessionNetworkConfiguration) + 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 SessionPoolSecret. +func (s SessionPoolSecret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionPoolSecret. +func (s *SessionPoolSecret) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SessionPoolUpdatableProperties. +func (s SessionPoolUpdatableProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionPoolUpdatableProperties. +func (s *SessionPoolUpdatableProperties) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &s.Properties) + 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 SessionPoolUpdatablePropertiesProperties. +func (s SessionPoolUpdatablePropertiesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customContainerTemplate", s.CustomContainerTemplate) + populate(objectMap, "dynamicPoolConfiguration", s.DynamicPoolConfiguration) + populate(objectMap, "scaleConfiguration", s.ScaleConfiguration) + populate(objectMap, "secrets", s.Secrets) + populate(objectMap, "sessionNetworkConfiguration", s.SessionNetworkConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionPoolUpdatablePropertiesProperties. +func (s *SessionPoolUpdatablePropertiesProperties) UnmarshalJSON(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 "customContainerTemplate": + err = unpopulate(val, "CustomContainerTemplate", &s.CustomContainerTemplate) + delete(rawMsg, key) + case "dynamicPoolConfiguration": + err = unpopulate(val, "DynamicPoolConfiguration", &s.DynamicPoolConfiguration) + delete(rawMsg, key) + case "scaleConfiguration": + err = unpopulate(val, "ScaleConfiguration", &s.ScaleConfiguration) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &s.Secrets) + delete(rawMsg, key) + case "sessionNetworkConfiguration": + err = unpopulate(val, "SessionNetworkConfiguration", &s.SessionNetworkConfiguration) + 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 SessionRegistryCredentials. +func (s SessionRegistryCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "passwordSecretRef", s.PasswordSecretRef) + populate(objectMap, "server", s.Server) + populate(objectMap, "username", s.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionRegistryCredentials. +func (s *SessionRegistryCredentials) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "passwordSecretRef": + err = unpopulate(val, "PasswordSecretRef", &s.PasswordSecretRef) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &s.Server) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &s.Username) + 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 SmbStorage. +func (s SmbStorage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessMode", s.AccessMode) + populate(objectMap, "domain", s.Domain) + populate(objectMap, "host", s.Host) + populate(objectMap, "password", s.Password) + populate(objectMap, "shareName", s.ShareName) + populate(objectMap, "username", s.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SmbStorage. +func (s *SmbStorage) UnmarshalJSON(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 "accessMode": + err = unpopulate(val, "AccessMode", &s.AccessMode) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &s.Domain) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &s.Host) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &s.Password) + delete(rawMsg, key) + case "shareName": + err = unpopulate(val, "ShareName", &s.ShareName) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &s.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SourceControl. func (s SourceControl) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6923,6 +11072,194 @@ func (s *SourceControlProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SpringBootAdminComponent. +func (s SpringBootAdminComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["componentType"] = JavaComponentTypeSpringBootAdmin + populate(objectMap, "configurations", s.Configurations) + populate(objectMap, "ingress", s.Ingress) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "scale", s.Scale) + populate(objectMap, "serviceBinds", s.ServiceBinds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringBootAdminComponent. +func (s *SpringBootAdminComponent) UnmarshalJSON(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 "componentType": + err = unpopulate(val, "ComponentType", &s.ComponentType) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &s.Configurations) + delete(rawMsg, key) + case "ingress": + err = unpopulate(val, "Ingress", &s.Ingress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "scale": + err = unpopulate(val, "Scale", &s.Scale) + delete(rawMsg, key) + case "serviceBinds": + err = unpopulate(val, "ServiceBinds", &s.ServiceBinds) + 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 SpringCloudConfigComponent. +func (s SpringCloudConfigComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["componentType"] = JavaComponentTypeSpringCloudConfig + populate(objectMap, "configurations", s.Configurations) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "scale", s.Scale) + populate(objectMap, "serviceBinds", s.ServiceBinds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringCloudConfigComponent. +func (s *SpringCloudConfigComponent) UnmarshalJSON(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 "componentType": + err = unpopulate(val, "ComponentType", &s.ComponentType) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &s.Configurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "scale": + err = unpopulate(val, "Scale", &s.Scale) + delete(rawMsg, key) + case "serviceBinds": + err = unpopulate(val, "ServiceBinds", &s.ServiceBinds) + 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 SpringCloudEurekaComponent. +func (s SpringCloudEurekaComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["componentType"] = JavaComponentTypeSpringCloudEureka + populate(objectMap, "configurations", s.Configurations) + populate(objectMap, "ingress", s.Ingress) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "scale", s.Scale) + populate(objectMap, "serviceBinds", s.ServiceBinds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringCloudEurekaComponent. +func (s *SpringCloudEurekaComponent) UnmarshalJSON(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 "componentType": + err = unpopulate(val, "ComponentType", &s.ComponentType) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &s.Configurations) + delete(rawMsg, key) + case "ingress": + err = unpopulate(val, "Ingress", &s.Ingress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "scale": + err = unpopulate(val, "Scale", &s.Scale) + delete(rawMsg, key) + case "serviceBinds": + err = unpopulate(val, "ServiceBinds", &s.ServiceBinds) + 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 SpringCloudGatewayComponent. +func (s SpringCloudGatewayComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["componentType"] = JavaComponentTypeSpringCloudGateway + populate(objectMap, "configurations", s.Configurations) + populate(objectMap, "ingress", s.Ingress) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "scale", s.Scale) + populate(objectMap, "serviceBinds", s.ServiceBinds) + populate(objectMap, "springCloudGatewayRoutes", s.SpringCloudGatewayRoutes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringCloudGatewayComponent. +func (s *SpringCloudGatewayComponent) UnmarshalJSON(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 "componentType": + err = unpopulate(val, "ComponentType", &s.ComponentType) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &s.Configurations) + delete(rawMsg, key) + case "ingress": + err = unpopulate(val, "Ingress", &s.Ingress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "scale": + err = unpopulate(val, "Scale", &s.Scale) + delete(rawMsg, key) + case "serviceBinds": + err = unpopulate(val, "ServiceBinds", &s.ServiceBinds) + delete(rawMsg, key) + case "springCloudGatewayRoutes": + err = unpopulate(val, "SpringCloudGatewayRoutes", &s.SpringCloudGatewayRoutes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6970,10 +11307,65 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TCPConnectionPool. +func (t TCPConnectionPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxConnections", t.MaxConnections) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TCPConnectionPool. +func (t *TCPConnectionPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxConnections": + err = unpopulate(val, "MaxConnections", &t.MaxConnections) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TCPRetryPolicy. +func (t TCPRetryPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxConnectAttempts", t.MaxConnectAttempts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TCPRetryPolicy. +func (t *TCPRetryPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxConnectAttempts": + err = unpopulate(val, "MaxConnectAttempts", &t.MaxConnectAttempts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TCPScaleRule. func (t TCPScaleRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "auth", t.Auth) + populate(objectMap, "identity", t.Identity) populate(objectMap, "metadata", t.Metadata) return json.Marshal(objectMap) } @@ -6990,6 +11382,9 @@ func (t *TCPScaleRule) UnmarshalJSON(data []byte) error { case "auth": err = unpopulate(val, "Auth", &t.Auth) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) case "metadata": err = unpopulate(val, "Metadata", &t.Metadata) delete(rawMsg, key) @@ -7052,6 +11447,37 @@ func (t *Template) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TimeoutPolicy. +func (t TimeoutPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionTimeoutInSeconds", t.ConnectionTimeoutInSeconds) + populate(objectMap, "responseTimeoutInSeconds", t.ResponseTimeoutInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeoutPolicy. +func (t *TimeoutPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionTimeoutInSeconds": + err = unpopulate(val, "ConnectionTimeoutInSeconds", &t.ConnectionTimeoutInSeconds) + delete(rawMsg, key) + case "responseTimeoutInSeconds": + err = unpopulate(val, "ResponseTimeoutInSeconds", &t.ResponseTimeoutInSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TokenStore. func (t TokenStore) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7087,6 +11513,37 @@ func (t *TokenStore) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TracesConfiguration. +func (t TracesConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinations", t.Destinations) + populate(objectMap, "includeDapr", t.IncludeDapr) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TracesConfiguration. +func (t *TracesConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinations": + err = unpopulate(val, "Destinations", &t.Destinations) + delete(rawMsg, key) + case "includeDapr": + err = unpopulate(val, "IncludeDapr", &t.IncludeDapr) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7457,9 +11914,189 @@ func (v *VolumeMount) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type WorkflowArtifacts. +func (w WorkflowArtifacts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "appSettings", w.AppSettings) + populateAny(objectMap, "files", w.Files) + populate(objectMap, "filesToDelete", w.FilesToDelete) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowArtifacts. +func (w *WorkflowArtifacts) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appSettings": + err = unpopulate(val, "AppSettings", &w.AppSettings) + delete(rawMsg, key) + case "files": + err = unpopulate(val, "Files", &w.Files) + delete(rawMsg, key) + case "filesToDelete": + err = unpopulate(val, "FilesToDelete", &w.FilesToDelete) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkflowEnvelope. +func (w WorkflowEnvelope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "kind", w.Kind) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowEnvelope. +func (w *WorkflowEnvelope) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &w.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkflowEnvelopeCollection. +func (w WorkflowEnvelopeCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowEnvelopeCollection. +func (w *WorkflowEnvelopeCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkflowEnvelopeProperties. +func (w WorkflowEnvelopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "files", w.Files) + populate(objectMap, "flowState", w.FlowState) + populate(objectMap, "health", w.Health) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowEnvelopeProperties. +func (w *WorkflowEnvelopeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "files": + err = unpopulate(val, "Files", &w.Files) + delete(rawMsg, key) + case "flowState": + err = unpopulate(val, "FlowState", &w.FlowState) + delete(rawMsg, key) + case "health": + err = unpopulate(val, "Health", &w.Health) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkflowHealth. +func (w WorkflowHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", w.Error) + populate(objectMap, "state", w.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowHealth. +func (w *WorkflowHealth) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &w.Error) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &w.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type WorkloadProfile. func (w WorkloadProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "enableFips", w.EnableFips) populate(objectMap, "maximumCount", w.MaximumCount) populate(objectMap, "minimumCount", w.MinimumCount) populate(objectMap, "name", w.Name) @@ -7476,6 +12113,9 @@ func (w *WorkloadProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "enableFips": + err = unpopulate(val, "EnableFips", &w.EnableFips) + delete(rawMsg, key) case "maximumCount": err = unpopulate(val, "MaximumCount", &w.MaximumCount) delete(rawMsg, key) diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go index fff8f0a4de..555790d533 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type NamespacesClient struct { } // NewNamespacesClient creates a new instance of NamespacesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewNamespacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NamespacesClient, error) { @@ -46,7 +47,7 @@ func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredentia // CheckNameAvailability - Checks if resource name is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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. @@ -94,7 +95,7 @@ func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 17cdd4c0da..6b9bf73988 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/namespaces_client_example_test.go @@ -18,7 +18,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_CheckNameAvailability.json +// 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 { @@ -46,7 +46,7 @@ func ExampleNamespacesClient_CheckNameAvailability_certificatesCheckNameAvailabi // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_CheckNameAvailability.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go index eafeab1287..4ce6487a98 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client.go @@ -10,11 +10,12 @@ 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. @@ -39,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available RP operations. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-08-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]{ @@ -72,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 60aebfb2ac..24b9a1a27e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/operations_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Operations_List.json +// 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 { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/options.go b/sdk/resourcemanager/appcontainers/armappcontainers/options.go index 0ef6af6435..9afc10537e 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/options.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/options.go @@ -8,6 +8,31 @@ package armappcontainers +// AppResiliencyClientCreateOrUpdateOptions contains the optional parameters for the AppResiliencyClient.CreateOrUpdate method. +type AppResiliencyClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AppResiliencyClientDeleteOptions contains the optional parameters for the AppResiliencyClient.Delete method. +type AppResiliencyClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AppResiliencyClientGetOptions contains the optional parameters for the AppResiliencyClient.Get method. +type AppResiliencyClientGetOptions struct { + // placeholder for future optional parameters +} + +// AppResiliencyClientListOptions contains the optional parameters for the AppResiliencyClient.NewListPager method. +type AppResiliencyClientListOptions struct { + // placeholder for future optional parameters +} + +// AppResiliencyClientUpdateOptions contains the optional parameters for the AppResiliencyClient.Update method. +type AppResiliencyClientUpdateOptions struct { + // placeholder for future optional parameters +} + // AvailableWorkloadProfilesClientGetOptions contains the optional parameters for the AvailableWorkloadProfilesClient.NewGetPager // method. type AvailableWorkloadProfilesClientGetOptions struct { @@ -19,6 +44,69 @@ type BillingMetersClientGetOptions struct { // placeholder for future optional parameters } +// BuildAuthTokenClientListOptions contains the optional parameters for the BuildAuthTokenClient.List method. +type BuildAuthTokenClientListOptions struct { + // placeholder for future optional parameters +} + +// BuildersClientBeginCreateOrUpdateOptions contains the optional parameters for the BuildersClient.BeginCreateOrUpdate method. +type BuildersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BuildersClientBeginDeleteOptions contains the optional parameters for the BuildersClient.BeginDelete method. +type BuildersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BuildersClientBeginUpdateOptions contains the optional parameters for the BuildersClient.BeginUpdate method. +type BuildersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BuildersClientGetOptions contains the optional parameters for the BuildersClient.Get method. +type BuildersClientGetOptions struct { + // placeholder for future optional parameters +} + +// BuildersClientListByResourceGroupOptions contains the optional parameters for the BuildersClient.NewListByResourceGroupPager +// method. +type BuildersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// BuildersClientListBySubscriptionOptions contains the optional parameters for the BuildersClient.NewListBySubscriptionPager +// method. +type BuildersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// BuildsByBuilderResourceClientListOptions contains the optional parameters for the BuildsByBuilderResourceClient.NewListPager +// method. +type BuildsByBuilderResourceClientListOptions struct { + // placeholder for future optional parameters +} + +// BuildsClientBeginCreateOrUpdateOptions contains the optional parameters for the BuildsClient.BeginCreateOrUpdate method. +type BuildsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BuildsClientBeginDeleteOptions contains the optional parameters for the BuildsClient.BeginDelete method. +type BuildsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BuildsClientGetOptions contains the optional parameters for the BuildsClient.Get method. +type BuildsClientGetOptions struct { + // placeholder for future optional parameters +} + // CertificatesClientCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.CreateOrUpdate method. type CertificatesClientCreateOrUpdateOptions struct { // Certificate to be created or updated @@ -207,6 +295,24 @@ type ContainerAppsAuthConfigsClientListByContainerAppOptions struct { // placeholder for future optional parameters } +// ContainerAppsBuildsByContainerAppClientListOptions contains the optional parameters for the ContainerAppsBuildsByContainerAppClient.NewListPager +// method. +type ContainerAppsBuildsByContainerAppClientListOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsBuildsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsBuildsClient.BeginDelete +// method. +type ContainerAppsBuildsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsBuildsClientGetOptions contains the optional parameters for the ContainerAppsBuildsClient.Get method. +type ContainerAppsBuildsClientGetOptions struct { + // placeholder for future optional parameters +} + // ContainerAppsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerAppsClient.BeginCreateOrUpdate // method. type ContainerAppsClientBeginCreateOrUpdateOptions struct { @@ -303,6 +409,39 @@ type ContainerAppsDiagnosticsClientListRevisionsOptions struct { Filter *string } +// ContainerAppsPatchesClientBeginApplyOptions contains the optional parameters for the ContainerAppsPatchesClient.BeginApply +// method. +type ContainerAppsPatchesClientBeginApplyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsPatchesClientBeginDeleteOptions contains the optional parameters for the ContainerAppsPatchesClient.BeginDelete +// method. +type ContainerAppsPatchesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsPatchesClientBeginSkipConfigureOptions contains the optional parameters for the ContainerAppsPatchesClient.BeginSkipConfigure +// method. +type ContainerAppsPatchesClientBeginSkipConfigureOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsPatchesClientGetOptions contains the optional parameters for the ContainerAppsPatchesClient.Get method. +type ContainerAppsPatchesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsPatchesClientListByContainerAppOptions contains the optional parameters for the ContainerAppsPatchesClient.NewListByContainerAppPager +// method. +type ContainerAppsPatchesClientListByContainerAppOptions struct { + // The filter to apply on the operation. For example, $filter=properties/patchApplyStatus eq 'Succeeded' + Filter *string +} + // ContainerAppsRevisionReplicasClientGetReplicaOptions contains the optional parameters for the ContainerAppsRevisionReplicasClient.GetReplica // method. type ContainerAppsRevisionReplicasClientGetReplicaOptions struct { @@ -346,18 +485,69 @@ type ContainerAppsRevisionsClientRestartRevisionOptions struct { // placeholder for future optional parameters } +// ContainerAppsSessionPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.BeginCreateOrUpdate +// method. +type ContainerAppsSessionPoolsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsSessionPoolsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.BeginDelete +// method. +type ContainerAppsSessionPoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsSessionPoolsClientBeginUpdateOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.BeginUpdate +// method. +type ContainerAppsSessionPoolsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ContainerAppsSessionPoolsClientGetOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.Get +// method. +type ContainerAppsSessionPoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsSessionPoolsClientListByResourceGroupOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.NewListByResourceGroupPager +// method. +type ContainerAppsSessionPoolsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ContainerAppsSessionPoolsClientListBySubscriptionOptions contains the optional parameters for the ContainerAppsSessionPoolsClient.NewListBySubscriptionPager +// method. +type ContainerAppsSessionPoolsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + // ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerAppsSourceControlsClient.BeginCreateOrUpdate // method. type ContainerAppsSourceControlsClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. ResumeToken string + + // Github personal access token used for SourceControl. + XMSGithubAuxiliary *string } // ContainerAppsSourceControlsClientBeginDeleteOptions contains the optional parameters for the ContainerAppsSourceControlsClient.BeginDelete // method. type ContainerAppsSourceControlsClientBeginDeleteOptions struct { + // Delete workflow. + DeleteWorkflow *bool + + // Ignore Workflow Deletion Failure. + IgnoreWorkflowDeletionFailure *bool + // Resumes the LRO from the provided token. ResumeToken string + + // Github personal access token used for SourceControl. + XMSGithubAuxiliary *string } // ContainerAppsSourceControlsClientGetOptions contains the optional parameters for the ContainerAppsSourceControlsClient.Get @@ -372,6 +562,30 @@ type ContainerAppsSourceControlsClientListByContainerAppOptions struct { // placeholder for future optional parameters } +// DaprComponentResiliencyPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DaprComponentResiliencyPoliciesClient.CreateOrUpdate +// method. +type DaprComponentResiliencyPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DaprComponentResiliencyPoliciesClientDeleteOptions contains the optional parameters for the DaprComponentResiliencyPoliciesClient.Delete +// method. +type DaprComponentResiliencyPoliciesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DaprComponentResiliencyPoliciesClientGetOptions contains the optional parameters for the DaprComponentResiliencyPoliciesClient.Get +// method. +type DaprComponentResiliencyPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DaprComponentResiliencyPoliciesClientListOptions contains the optional parameters for the DaprComponentResiliencyPoliciesClient.NewListPager +// method. +type DaprComponentResiliencyPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + // DaprComponentsClientCreateOrUpdateOptions contains the optional parameters for the DaprComponentsClient.CreateOrUpdate // method. type DaprComponentsClientCreateOrUpdateOptions struct { @@ -398,6 +612,91 @@ type DaprComponentsClientListSecretsOptions struct { // placeholder for future optional parameters } +// DaprSubscriptionsClientCreateOrUpdateOptions contains the optional parameters for the DaprSubscriptionsClient.CreateOrUpdate +// method. +type DaprSubscriptionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DaprSubscriptionsClientDeleteOptions contains the optional parameters for the DaprSubscriptionsClient.Delete method. +type DaprSubscriptionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DaprSubscriptionsClientGetOptions contains the optional parameters for the DaprSubscriptionsClient.Get method. +type DaprSubscriptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DaprSubscriptionsClientListOptions contains the optional parameters for the DaprSubscriptionsClient.NewListPager method. +type DaprSubscriptionsClientListOptions struct { + // placeholder for future optional parameters +} + +// DotNetComponentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DotNetComponentsClient.BeginCreateOrUpdate +// method. +type DotNetComponentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DotNetComponentsClientBeginDeleteOptions contains the optional parameters for the DotNetComponentsClient.BeginDelete method. +type DotNetComponentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DotNetComponentsClientBeginUpdateOptions contains the optional parameters for the DotNetComponentsClient.BeginUpdate method. +type DotNetComponentsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DotNetComponentsClientGetOptions contains the optional parameters for the DotNetComponentsClient.Get method. +type DotNetComponentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DotNetComponentsClientListOptions contains the optional parameters for the DotNetComponentsClient.NewListPager method. +type DotNetComponentsClientListOptions struct { + // placeholder for future optional parameters +} + +// FunctionsExtensionClientInvokeFunctionsHostOptions contains the optional parameters for the FunctionsExtensionClient.InvokeFunctionsHost +// method. +type FunctionsExtensionClientInvokeFunctionsHostOptions struct { + // placeholder for future optional parameters +} + +// JavaComponentsClientBeginCreateOrUpdateOptions contains the optional parameters for the JavaComponentsClient.BeginCreateOrUpdate +// method. +type JavaComponentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JavaComponentsClientBeginDeleteOptions contains the optional parameters for the JavaComponentsClient.BeginDelete method. +type JavaComponentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JavaComponentsClientBeginUpdateOptions contains the optional parameters for the JavaComponentsClient.BeginUpdate method. +type JavaComponentsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JavaComponentsClientGetOptions contains the optional parameters for the JavaComponentsClient.Get method. +type JavaComponentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JavaComponentsClientListOptions contains the optional parameters for the JavaComponentsClient.NewListPager method. +type JavaComponentsClientListOptions struct { + // placeholder for future optional parameters +} + // JobsClientBeginCreateOrUpdateOptions contains the optional parameters for the JobsClient.BeginCreateOrUpdate method. type JobsClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. @@ -410,6 +709,12 @@ type JobsClientBeginDeleteOptions struct { ResumeToken string } +// JobsClientBeginResumeOptions contains the optional parameters for the JobsClient.BeginResume method. +type JobsClientBeginResumeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // JobsClientBeginStartOptions contains the optional parameters for the JobsClient.BeginStart method. type JobsClientBeginStartOptions struct { // Resumes the LRO from the provided token. @@ -432,6 +737,12 @@ type JobsClientBeginStopMultipleExecutionsOptions struct { ResumeToken string } +// JobsClientBeginSuspendOptions contains the optional parameters for the JobsClient.BeginSuspend method. +type JobsClientBeginSuspendOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // JobsClientBeginUpdateOptions contains the optional parameters for the JobsClient.BeginUpdate method. type JobsClientBeginUpdateOptions struct { // Resumes the LRO from the provided token. @@ -479,6 +790,49 @@ type JobsExecutionsClientListOptions struct { Filter *string } +// LogicAppsClientCreateOrUpdateOptions contains the optional parameters for the LogicAppsClient.CreateOrUpdate method. +type LogicAppsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// LogicAppsClientDeleteOptions contains the optional parameters for the LogicAppsClient.Delete method. +type LogicAppsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// LogicAppsClientDeployWorkflowArtifactsOptions contains the optional parameters for the LogicAppsClient.DeployWorkflowArtifacts +// method. +type LogicAppsClientDeployWorkflowArtifactsOptions struct { + // Application settings and files of the workflow. + WorkflowArtifacts *WorkflowArtifacts +} + +// LogicAppsClientGetOptions contains the optional parameters for the LogicAppsClient.Get method. +type LogicAppsClientGetOptions struct { + // placeholder for future optional parameters +} + +// LogicAppsClientGetWorkflowOptions contains the optional parameters for the LogicAppsClient.GetWorkflow method. +type LogicAppsClientGetWorkflowOptions struct { + // placeholder for future optional parameters +} + +// LogicAppsClientInvokeOptions contains the optional parameters for the LogicAppsClient.Invoke method. +type LogicAppsClientInvokeOptions struct { + // placeholder for future optional parameters +} + +// LogicAppsClientListWorkflowsConnectionsOptions contains the optional parameters for the LogicAppsClient.ListWorkflowsConnections +// method. +type LogicAppsClientListWorkflowsConnectionsOptions struct { + // placeholder for future optional parameters +} + +// LogicAppsClientListWorkflowsOptions contains the optional parameters for the LogicAppsClient.NewListWorkflowsPager method. +type LogicAppsClientListWorkflowsOptions struct { + // placeholder for future optional parameters +} + // ManagedCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedCertificatesClient.BeginCreateOrUpdate // method. type ManagedCertificatesClientBeginCreateOrUpdateOptions struct { @@ -521,6 +875,38 @@ type ManagedEnvironmentDiagnosticsClientListDetectorsOptions struct { // placeholder for future optional parameters } +// ManagedEnvironmentPrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedEnvironmentPrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type ManagedEnvironmentPrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedEnvironmentPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the ManagedEnvironmentPrivateEndpointConnectionsClient.BeginDelete +// method. +type ManagedEnvironmentPrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedEnvironmentPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the ManagedEnvironmentPrivateEndpointConnectionsClient.Get +// method. +type ManagedEnvironmentPrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentPrivateEndpointConnectionsClientListOptions contains the optional parameters for the ManagedEnvironmentPrivateEndpointConnectionsClient.NewListPager +// method. +type ManagedEnvironmentPrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedEnvironmentPrivateLinkResourcesClientListOptions contains the optional parameters for the ManagedEnvironmentPrivateLinkResourcesClient.NewListPager +// method. +type ManagedEnvironmentPrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + // ManagedEnvironmentUsagesClientListOptions contains the optional parameters for the ManagedEnvironmentUsagesClient.NewListPager // method. type ManagedEnvironmentUsagesClientListOptions struct { diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/polymorphic_helpers.go b/sdk/resourcemanager/appcontainers/armappcontainers/polymorphic_helpers.go new file mode 100644 index 0000000000..b87e1909d3 --- /dev/null +++ b/sdk/resourcemanager/appcontainers/armappcontainers/polymorphic_helpers.go @@ -0,0 +1,40 @@ +//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 "encoding/json" + +func unmarshalJavaComponentPropertiesClassification(rawMsg json.RawMessage) (JavaComponentPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b JavaComponentPropertiesClassification + switch m["componentType"] { + case string(JavaComponentTypeNacos): + b = &NacosComponent{} + case string(JavaComponentTypeSpringBootAdmin): + b = &SpringBootAdminComponent{} + case string(JavaComponentTypeSpringCloudConfig): + b = &SpringCloudConfigComponent{} + case string(JavaComponentTypeSpringCloudEureka): + b = &SpringCloudEurekaComponent{} + case string(JavaComponentTypeSpringCloudGateway): + b = &SpringCloudGatewayComponent{} + default: + b = &JavaComponentProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/responses.go b/sdk/resourcemanager/appcontainers/armappcontainers/responses.go index c15629c190..2c8ca17c00 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/responses.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/responses.go @@ -8,6 +8,35 @@ package armappcontainers +// AppResiliencyClientCreateOrUpdateResponse contains the response from method AppResiliencyClient.CreateOrUpdate. +type AppResiliencyClientCreateOrUpdateResponse struct { + // Configuration to setup App Resiliency + AppResiliency +} + +// AppResiliencyClientDeleteResponse contains the response from method AppResiliencyClient.Delete. +type AppResiliencyClientDeleteResponse struct { + // placeholder for future response values +} + +// AppResiliencyClientGetResponse contains the response from method AppResiliencyClient.Get. +type AppResiliencyClientGetResponse struct { + // Configuration to setup App Resiliency + AppResiliency +} + +// AppResiliencyClientListResponse contains the response from method AppResiliencyClient.NewListPager. +type AppResiliencyClientListResponse struct { + // Collection of AppResiliency policies + AppResiliencyCollection +} + +// AppResiliencyClientUpdateResponse contains the response from method AppResiliencyClient.Update. +type AppResiliencyClientUpdateResponse struct { + // Configuration to setup App Resiliency + AppResiliency +} + // AvailableWorkloadProfilesClientGetResponse contains the response from method AvailableWorkloadProfilesClient.NewGetPager. type AvailableWorkloadProfilesClientGetResponse struct { // Collection of available workload profiles in the location. @@ -20,6 +49,70 @@ type BillingMetersClientGetResponse struct { BillingMeterCollection } +// BuildAuthTokenClientListResponse contains the response from method BuildAuthTokenClient.List. +type BuildAuthTokenClientListResponse struct { + // Build Auth Token. + BuildToken +} + +// BuildersClientCreateOrUpdateResponse contains the response from method BuildersClient.BeginCreateOrUpdate. +type BuildersClientCreateOrUpdateResponse struct { + // Information about the SourceToCloud builder resource. + BuilderResource +} + +// BuildersClientDeleteResponse contains the response from method BuildersClient.BeginDelete. +type BuildersClientDeleteResponse struct { + // placeholder for future response values +} + +// BuildersClientGetResponse contains the response from method BuildersClient.Get. +type BuildersClientGetResponse struct { + // Information about the SourceToCloud builder resource. + BuilderResource +} + +// BuildersClientListByResourceGroupResponse contains the response from method BuildersClient.NewListByResourceGroupPager. +type BuildersClientListByResourceGroupResponse struct { + // The response of a BuilderResource list operation. + BuilderCollection +} + +// BuildersClientListBySubscriptionResponse contains the response from method BuildersClient.NewListBySubscriptionPager. +type BuildersClientListBySubscriptionResponse struct { + // The response of a BuilderResource list operation. + BuilderCollection +} + +// BuildersClientUpdateResponse contains the response from method BuildersClient.BeginUpdate. +type BuildersClientUpdateResponse struct { + // Information about the SourceToCloud builder resource. + BuilderResource +} + +// BuildsByBuilderResourceClientListResponse contains the response from method BuildsByBuilderResourceClient.NewListPager. +type BuildsByBuilderResourceClientListResponse struct { + // The response of a BuildResource list operation. + BuildCollection +} + +// BuildsClientCreateOrUpdateResponse contains the response from method BuildsClient.BeginCreateOrUpdate. +type BuildsClientCreateOrUpdateResponse struct { + // Information pertaining to an individual build. + BuildResource +} + +// BuildsClientDeleteResponse contains the response from method BuildsClient.BeginDelete. +type BuildsClientDeleteResponse struct { + // placeholder for future response values +} + +// BuildsClientGetResponse contains the response from method BuildsClient.Get. +type BuildsClientGetResponse struct { + // Information pertaining to an individual build. + BuildResource +} + // CertificatesClientCreateOrUpdateResponse contains the response from method CertificatesClient.CreateOrUpdate. type CertificatesClientCreateOrUpdateResponse struct { // Certificate used for Custom Domain bindings of Container Apps in a Managed Environment @@ -206,6 +299,23 @@ type ContainerAppsAuthConfigsClientListByContainerAppResponse struct { AuthConfigCollection } +// ContainerAppsBuildsByContainerAppClientListResponse contains the response from method ContainerAppsBuildsByContainerAppClient.NewListPager. +type ContainerAppsBuildsByContainerAppClientListResponse struct { + // The response of a Container Apps Build Resource list operation. + ContainerAppsBuildCollection +} + +// ContainerAppsBuildsClientDeleteResponse contains the response from method ContainerAppsBuildsClient.BeginDelete. +type ContainerAppsBuildsClientDeleteResponse struct { + // placeholder for future response values +} + +// ContainerAppsBuildsClientGetResponse contains the response from method ContainerAppsBuildsClient.Get. +type ContainerAppsBuildsClientGetResponse struct { + // Information pertaining to an individual build. + ContainerAppsBuildResource +} + // ContainerAppsClientCreateOrUpdateResponse contains the response from method ContainerAppsClient.BeginCreateOrUpdate. type ContainerAppsClientCreateOrUpdateResponse struct { // Container App. @@ -301,6 +411,34 @@ type ContainerAppsDiagnosticsClientListRevisionsResponse struct { RevisionCollection } +// ContainerAppsPatchesClientApplyResponse contains the response from method ContainerAppsPatchesClient.BeginApply. +type ContainerAppsPatchesClientApplyResponse struct { + // Container App Patch + ContainerAppsPatchResource +} + +// ContainerAppsPatchesClientDeleteResponse contains the response from method ContainerAppsPatchesClient.BeginDelete. +type ContainerAppsPatchesClientDeleteResponse struct { + // placeholder for future response values +} + +// ContainerAppsPatchesClientGetResponse contains the response from method ContainerAppsPatchesClient.Get. +type ContainerAppsPatchesClientGetResponse struct { + // Container App Patch + ContainerAppsPatchResource +} + +// ContainerAppsPatchesClientListByContainerAppResponse contains the response from method ContainerAppsPatchesClient.NewListByContainerAppPager. +type ContainerAppsPatchesClientListByContainerAppResponse struct { + // Container App patch collection + PatchCollection +} + +// ContainerAppsPatchesClientSkipConfigureResponse contains the response from method ContainerAppsPatchesClient.BeginSkipConfigure. +type ContainerAppsPatchesClientSkipConfigureResponse struct { + // placeholder for future response values +} + // ContainerAppsRevisionReplicasClientGetReplicaResponse contains the response from method ContainerAppsRevisionReplicasClient.GetReplica. type ContainerAppsRevisionReplicasClientGetReplicaResponse struct { // Container App Revision Replica. @@ -340,6 +478,41 @@ type ContainerAppsRevisionsClientRestartRevisionResponse struct { // placeholder for future response values } +// ContainerAppsSessionPoolsClientCreateOrUpdateResponse contains the response from method ContainerAppsSessionPoolsClient.BeginCreateOrUpdate. +type ContainerAppsSessionPoolsClientCreateOrUpdateResponse struct { + // Container App session pool. + SessionPool +} + +// ContainerAppsSessionPoolsClientDeleteResponse contains the response from method ContainerAppsSessionPoolsClient.BeginDelete. +type ContainerAppsSessionPoolsClientDeleteResponse struct { + // placeholder for future response values +} + +// ContainerAppsSessionPoolsClientGetResponse contains the response from method ContainerAppsSessionPoolsClient.Get. +type ContainerAppsSessionPoolsClientGetResponse struct { + // Container App session pool. + SessionPool +} + +// ContainerAppsSessionPoolsClientListByResourceGroupResponse contains the response from method ContainerAppsSessionPoolsClient.NewListByResourceGroupPager. +type ContainerAppsSessionPoolsClientListByResourceGroupResponse struct { + // Session pool collection Azure resource. + SessionPoolCollection +} + +// ContainerAppsSessionPoolsClientListBySubscriptionResponse contains the response from method ContainerAppsSessionPoolsClient.NewListBySubscriptionPager. +type ContainerAppsSessionPoolsClientListBySubscriptionResponse struct { + // Session pool collection Azure resource. + SessionPoolCollection +} + +// ContainerAppsSessionPoolsClientUpdateResponse contains the response from method ContainerAppsSessionPoolsClient.BeginUpdate. +type ContainerAppsSessionPoolsClientUpdateResponse struct { + // Container App session pool. + SessionPool +} + // ContainerAppsSourceControlsClientCreateOrUpdateResponse contains the response from method ContainerAppsSourceControlsClient.BeginCreateOrUpdate. type ContainerAppsSourceControlsClientCreateOrUpdateResponse struct { // Container App SourceControl. @@ -363,6 +536,29 @@ type ContainerAppsSourceControlsClientListByContainerAppResponse struct { SourceControlCollection } +// DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse contains the response from method DaprComponentResiliencyPoliciesClient.CreateOrUpdate. +type DaprComponentResiliencyPoliciesClientCreateOrUpdateResponse struct { + // Dapr Component Resiliency Policy. + DaprComponentResiliencyPolicy +} + +// DaprComponentResiliencyPoliciesClientDeleteResponse contains the response from method DaprComponentResiliencyPoliciesClient.Delete. +type DaprComponentResiliencyPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// DaprComponentResiliencyPoliciesClientGetResponse contains the response from method DaprComponentResiliencyPoliciesClient.Get. +type DaprComponentResiliencyPoliciesClientGetResponse struct { + // Dapr Component Resiliency Policy. + DaprComponentResiliencyPolicy +} + +// DaprComponentResiliencyPoliciesClientListResponse contains the response from method DaprComponentResiliencyPoliciesClient.NewListPager. +type DaprComponentResiliencyPoliciesClientListResponse struct { + // Dapr Component Resiliency Policies ARM resource. + DaprComponentResiliencyPoliciesCollection +} + // DaprComponentsClientCreateOrUpdateResponse contains the response from method DaprComponentsClient.CreateOrUpdate. type DaprComponentsClientCreateOrUpdateResponse struct { // Dapr Component. @@ -392,6 +588,92 @@ type DaprComponentsClientListSecretsResponse struct { DaprSecretsCollection } +// DaprSubscriptionsClientCreateOrUpdateResponse contains the response from method DaprSubscriptionsClient.CreateOrUpdate. +type DaprSubscriptionsClientCreateOrUpdateResponse struct { + // Dapr PubSub Event Subscription. + DaprSubscription +} + +// DaprSubscriptionsClientDeleteResponse contains the response from method DaprSubscriptionsClient.Delete. +type DaprSubscriptionsClientDeleteResponse struct { + // placeholder for future response values +} + +// DaprSubscriptionsClientGetResponse contains the response from method DaprSubscriptionsClient.Get. +type DaprSubscriptionsClientGetResponse struct { + // Dapr PubSub Event Subscription. + DaprSubscription +} + +// DaprSubscriptionsClientListResponse contains the response from method DaprSubscriptionsClient.NewListPager. +type DaprSubscriptionsClientListResponse struct { + // Dapr Subscriptions ARM resource. + DaprSubscriptionsCollection +} + +// DotNetComponentsClientCreateOrUpdateResponse contains the response from method DotNetComponentsClient.BeginCreateOrUpdate. +type DotNetComponentsClientCreateOrUpdateResponse struct { + // .NET Component. + DotNetComponent +} + +// DotNetComponentsClientDeleteResponse contains the response from method DotNetComponentsClient.BeginDelete. +type DotNetComponentsClientDeleteResponse struct { + // placeholder for future response values +} + +// DotNetComponentsClientGetResponse contains the response from method DotNetComponentsClient.Get. +type DotNetComponentsClientGetResponse struct { + // .NET Component. + DotNetComponent +} + +// DotNetComponentsClientListResponse contains the response from method DotNetComponentsClient.NewListPager. +type DotNetComponentsClientListResponse struct { + // .NET Components ARM resource. + DotNetComponentsCollection +} + +// DotNetComponentsClientUpdateResponse contains the response from method DotNetComponentsClient.BeginUpdate. +type DotNetComponentsClientUpdateResponse struct { + // .NET Component. + DotNetComponent +} + +// FunctionsExtensionClientInvokeFunctionsHostResponse contains the response from method FunctionsExtensionClient.InvokeFunctionsHost. +type FunctionsExtensionClientInvokeFunctionsHostResponse struct { + Value *string +} + +// JavaComponentsClientCreateOrUpdateResponse contains the response from method JavaComponentsClient.BeginCreateOrUpdate. +type JavaComponentsClientCreateOrUpdateResponse struct { + // Java Component. + JavaComponent +} + +// JavaComponentsClientDeleteResponse contains the response from method JavaComponentsClient.BeginDelete. +type JavaComponentsClientDeleteResponse struct { + // placeholder for future response values +} + +// JavaComponentsClientGetResponse contains the response from method JavaComponentsClient.Get. +type JavaComponentsClientGetResponse struct { + // Java Component. + JavaComponent +} + +// JavaComponentsClientListResponse contains the response from method JavaComponentsClient.NewListPager. +type JavaComponentsClientListResponse struct { + // Java Components ARM resource. + JavaComponentsCollection +} + +// JavaComponentsClientUpdateResponse contains the response from method JavaComponentsClient.BeginUpdate. +type JavaComponentsClientUpdateResponse struct { + // Java Component. + JavaComponent +} + // JobsClientCreateOrUpdateResponse contains the response from method JobsClient.BeginCreateOrUpdate. type JobsClientCreateOrUpdateResponse struct { // Container App Job @@ -445,6 +727,12 @@ type JobsClientProxyGetResponse struct { Job } +// JobsClientResumeResponse contains the response from method JobsClient.BeginResume. +type JobsClientResumeResponse struct { + // Container App Job + Job +} + // JobsClientStartResponse contains the response from method JobsClient.BeginStart. type JobsClientStartResponse struct { // Container App's Job execution name. @@ -462,6 +750,12 @@ type JobsClientStopMultipleExecutionsResponse struct { ContainerAppJobExecutions } +// JobsClientSuspendResponse contains the response from method JobsClient.BeginSuspend. +type JobsClientSuspendResponse struct { + // Container App Job + Job +} + // JobsClientUpdateResponse contains the response from method JobsClient.BeginUpdate. type JobsClientUpdateResponse struct { // Container App Job @@ -474,6 +768,52 @@ type JobsExecutionsClientListResponse struct { ContainerAppJobExecutions } +// LogicAppsClientCreateOrUpdateResponse contains the response from method LogicAppsClient.CreateOrUpdate. +type LogicAppsClientCreateOrUpdateResponse struct { + // A logic app extension resource + LogicApp +} + +// LogicAppsClientDeleteResponse contains the response from method LogicAppsClient.Delete. +type LogicAppsClientDeleteResponse struct { + // placeholder for future response values +} + +// LogicAppsClientDeployWorkflowArtifactsResponse contains the response from method LogicAppsClient.DeployWorkflowArtifacts. +type LogicAppsClientDeployWorkflowArtifactsResponse struct { + // placeholder for future response values +} + +// LogicAppsClientGetResponse contains the response from method LogicAppsClient.Get. +type LogicAppsClientGetResponse struct { + // A logic app extension resource + LogicApp +} + +// LogicAppsClientGetWorkflowResponse contains the response from method LogicAppsClient.GetWorkflow. +type LogicAppsClientGetWorkflowResponse struct { + // Workflow properties definition. + WorkflowEnvelope +} + +// LogicAppsClientInvokeResponse contains the response from method LogicAppsClient.Invoke. +type LogicAppsClientInvokeResponse struct { + // Anything + Interface any +} + +// LogicAppsClientListWorkflowsConnectionsResponse contains the response from method LogicAppsClient.ListWorkflowsConnections. +type LogicAppsClientListWorkflowsConnectionsResponse struct { + // Workflow properties definition. + WorkflowEnvelope +} + +// LogicAppsClientListWorkflowsResponse contains the response from method LogicAppsClient.NewListWorkflowsPager. +type LogicAppsClientListWorkflowsResponse struct { + // Collection of workflow information elements. + WorkflowEnvelopeCollection +} + // 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 @@ -515,6 +855,35 @@ type ManagedEnvironmentDiagnosticsClientListDetectorsResponse struct { DiagnosticsCollection } +// ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method ManagedEnvironmentPrivateEndpointConnectionsClient.BeginCreateOrUpdate. +type ManagedEnvironmentPrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnection +} + +// ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse contains the response from method ManagedEnvironmentPrivateEndpointConnectionsClient.BeginDelete. +type ManagedEnvironmentPrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse contains the response from method ManagedEnvironmentPrivateEndpointConnectionsClient.Get. +type ManagedEnvironmentPrivateEndpointConnectionsClientGetResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnection +} + +// ManagedEnvironmentPrivateEndpointConnectionsClientListResponse contains the response from method ManagedEnvironmentPrivateEndpointConnectionsClient.NewListPager. +type ManagedEnvironmentPrivateEndpointConnectionsClientListResponse struct { + // List of private endpoint connection associated with the specified resource + PrivateEndpointConnectionListResult +} + +// ManagedEnvironmentPrivateLinkResourcesClientListResponse contains the response from method ManagedEnvironmentPrivateLinkResourcesClient.NewListPager. +type ManagedEnvironmentPrivateLinkResourcesClientListResponse struct { + // A list of private link resources + PrivateLinkResourceListResult +} + // ManagedEnvironmentUsagesClientListResponse contains the response from method ManagedEnvironmentUsagesClient.NewListPager. type ManagedEnvironmentUsagesClientListResponse struct { ListUsagesResult diff --git a/sdk/resourcemanager/appcontainers/armappcontainers/time_rfc3339.go b/sdk/resourcemanager/appcontainers/armappcontainers/time_rfc3339.go index 947aa91dde..38c2fcaebc 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/time_rfc3339.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/time_rfc3339.go @@ -11,11 +11,12 @@ 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 cd4392d515..4788ab9899 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/usages_client.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/usages_client.go @@ -11,13 +11,14 @@ 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. @@ -28,7 +29,7 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { @@ -46,7 +47,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-03-01 +// Generated from API version 2024-08-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] { @@ -88,7 +89,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-08-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 index 37d2893d7d..d3961eb145 100644 --- a/sdk/resourcemanager/appcontainers/armappcontainers/usages_client_example_test.go +++ b/sdk/resourcemanager/appcontainers/armappcontainers/usages_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0/specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Usages_List.json +// 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 {