[Release] sdk/resourcemanager/appcontainers/armappcontainers/3.1.0-beta.1 (#23643)
* [Release] sdk/resourcemanager/appcontainers/armappcontainers/3.1.0-beta.1 generation from spec commit: 366aaa13cdd218b9adac716680e49473673410c8 * fix lint
This commit is contained in:
Родитель
2ede004eff
Коммит
8988b49750
|
@ -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
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ clientFactory, err := armappcontainers.NewClientFactory(<subscription ID>, 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
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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),
|
||||
// },
|
||||
// },
|
||||
// }},
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -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
|
||||
```
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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"),
|
||||
// }
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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)
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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)
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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"),
|
||||
// },
|
||||
// }},
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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("<subscription-id>", 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"),
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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)
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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),
|
||||
// },
|
||||
// }},
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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"),
|
||||
// },
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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"),
|
||||
// },
|
||||
// }
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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)
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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("<tenantid>"),
|
||||
},
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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)
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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)
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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("<subscription-id>", 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)
|
||||
}
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<appName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<appName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<appName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<appName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<appName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P<name>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P<buildName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P<buildName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P<buildName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P<buildName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/builders/(?P<builderName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P<buildName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P<buildName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches/(?P<patchName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches/(?P<patchName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches/(?P<patchName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/patches/(?P<patchName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/sessionPools/(?P<sessionPoolName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/sessionPools/(?P<sessionPoolName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/sessionPools/(?P<sessionPoolName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/sessionPools/(?P<sessionPoolName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprComponents/(?P<componentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprComponents/(?P<componentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprComponents/(?P<componentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resiliencyPolicies/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprComponents/(?P<componentName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprSubscriptions/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprSubscriptions/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/daprSubscriptions/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dotNetComponents/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dotNetComponents/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dotNetComponents/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dotNetComponents/(?P<name>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revisions/(?P<revisionName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/functions/(?P<functionAppName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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{},
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/javaComponents/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/javaComponents/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/javaComponents/(?P<name>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/javaComponents/(?P<name>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/jobs/(?P<jobName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/jobs/(?P<jobName>[!#&$-;=?-\[\]_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")}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P<logicAppName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P<logicAppName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P<logicAppName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P<logicAppName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P<logicAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/workflows/(?P<workflowName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P<logicAppName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P<logicAppName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/containerApps/(?P<containerAppName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/logicApps/(?P<logicAppName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P<privateEndpointConnectionName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P<privateEndpointConnectionName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P<privateEndpointConnectionName>[!#&$-;=?-\[\]_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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.App/managedEnvironments/(?P<environmentName>[!#&$-;=?-\[\]_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
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче